2015-10-18 18:29:26 +02:00
|
|
|
|
|
|
|
<template>
|
2015-11-09 20:20:44 +01:00
|
|
|
<div class="toggle-switch" @click="switch" :class="{'active': isActive}">
|
2015-11-01 21:00:57 +01:00
|
|
|
<input type="hidden" :name="name" :value="value"/>
|
2015-10-18 18:29:26 +02:00
|
|
|
<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';
|
|
|
|
}
|
|
|
|
}
|
2015-11-01 21:00:57 +01:00
|
|
|
};
|
2015-10-18 18:29:26 +02:00
|
|
|
</script>
|