mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-28 02:40:05 +08:00
Made header more responsive and added nicer settings switches
This commit is contained in:
28
resources/assets/js/components/toggle-switch.vue
Normal file
28
resources/assets/js/components/toggle-switch.vue
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
<template>
|
||||
<div class="toggle-switch" v-on="click: switch" v-class="active: isActive">
|
||||
<input type="hidden" v-attr="name: name, value: value"/>
|
||||
<div class="switch-handle"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
props: ['name', 'value'],
|
||||
data: function() {
|
||||
return {
|
||||
isActive: this.value == true && this.value != 'false'
|
||||
}
|
||||
},
|
||||
ready: function() {
|
||||
this.value = (this.value == true && this.value != 'false') ? 'true' : 'false';
|
||||
},
|
||||
methods: {
|
||||
switch: function() {
|
||||
this.isActive = !this.isActive;
|
||||
this.value = this.isActive ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user