[wip] darkmode
This commit is contained in:
parent
cba07d08d0
commit
2145730409
2 changed files with 44 additions and 55 deletions
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue