Files
crater/resources/assets/js/components/custom-fields/SwitchField.vue
Mohit Panjwani 89ee58590c build version 400
2020-12-02 17:54:08 +05:30

38 lines
635 B
Vue

<template>
<sw-switch
v-model="switchData"
class="btn-switch"
@change="onChange"
style="margin-top: -15px"
/>
</template>
<script>
export default {
props: {
type: {
type: String,
default: 'text',
required: false,
},
field: {
type: Object,
default: null,
required: true,
},
},
data() {
return {
switchData: false,
}
},
mounted() {
this.switchData = this.field && this.field.defaultAnswer ? true : false
},
methods: {
onChange() {
this.$emit('update', { field: this.field, value: this.switchData })
},
},
}
</script>