atst/js/components/nested_checkbox_input.js
2019-04-30 14:43:23 -04:00

32 lines
488 B
JavaScript

import { emitEvent } from '../lib/emitters'
export default {
name: 'nestedcheckboxinput',
props: {
name: String,
isParentChecked: Boolean,
},
data: function() {
return {
isChecked: false,
}
},
updated: function() {
if (!this.isParentChecked) {
this.isChecked = false
}
},
methods: {
onInput: function(e) {
emitEvent('field-change', this, {
value: e.target.checked,
name: this.name,
})
},
},
}