Merge pull request #98 from JsSucks/ui

Ui
This commit is contained in:
Alexei Stukov 2018-02-05 16:01:51 +02:00 committed by GitHub
commit 9fb51c57b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -76,6 +76,8 @@
if (cat.settings.find(s => s.id === setting.id).value !== setting.value) { if (cat.settings.find(s => s.id === setting.id).value !== setting.value) {
changed = true; changed = true;
setting.changed = true; setting.changed = true;
} else {
setting.changed = false;
} }
} }
} }

View File

@ -12,7 +12,7 @@
<div class="bd-setting-switch"> <div class="bd-setting-switch">
<div class="bd-title"> <div class="bd-title">
<h3>{{setting.text}}</h3> <h3>{{setting.text}}</h3>
<label class="bd-switch-wrapper"> <label class="bd-switch-wrapper" @click="toggle">
<input type="checkbox" class="bd-switch-checkbox" /> <input type="checkbox" class="bd-switch-checkbox" />
<div class="bd-switch" :class="{'bd-checked': setting.value}" /> <div class="bd-switch" :class="{'bd-checked': setting.value}" />
</label> </label>
@ -22,6 +22,11 @@
</template> </template>
<script> <script>
export default { export default {
props: ['setting', 'change'] props: ['setting', 'change'],
methods: {
toggle() {
this.change(this.setting.id, !this.setting.value);
}
}
} }
</script> </script>