mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-30 13:11:08 -04:00
build version 400
This commit is contained in:
37
resources/assets/js/components/custom-fields/SwitchField.vue
Normal file
37
resources/assets/js/components/custom-fields/SwitchField.vue
Normal file
@ -0,0 +1,37 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user