From 2145730409bd0deeb533b9b0838311c02c431d58 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 20 Apr 2018 04:16:48 +0900 Subject: [PATCH] [wip] darkmode --- src/client/app/desktop/script.ts | 15 +++- .../app/desktop/views/widgets/users.vue | 84 +++++++------------ 2 files changed, 44 insertions(+), 55 deletions(-) diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts index ba7a64ff22..e79573c77a 100644 --- a/src/client/app/desktop/script.ts +++ b/src/client/app/desktop/script.ts @@ -46,15 +46,28 @@ init(async (launch) => { // Dark/Light Vue.mixin({ + data() { + return { + _darkmode_: false + }; + }, + beforeCreate() { + // なぜか警告が出るため + this._darkmode_ = false; + }, mounted() { const set = () => { - if (!this.$el || !this.os || !this.os.i) return; + if (!this.$el || !this.$el.setAttribute || !this.os || !this.os.i) return; if (this.os.i.clientSettings.dark) { document.documentElement.setAttribute('data-darkmode', 'true'); this.$el.setAttribute('data-darkmode', 'true'); + this._darkmode_ = true; + this.$forceUpdate(); } else { document.documentElement.removeAttribute('data-darkmode'); this.$el.removeAttribute('data-darkmode'); + this._darkmode_ = false; + this.$forceUpdate(); } }; diff --git a/src/client/app/desktop/views/widgets/users.vue b/src/client/app/desktop/views/widgets/users.vue index 0955ebbd71..3967ffaf6d 100644 --- a/src/client/app/desktop/views/widgets/users.vue +++ b/src/client/app/desktop/views/widgets/users.vue @@ -1,23 +1,26 @@ @@ -71,43 +74,10 @@ export default define({