Added strict one-way binding to all form components

This commit is contained in:
Joel Collins 2019-06-14 15:35:08 +01:00
parent 4a0351f80c
commit 5e69e52bcd
8 changed files with 181 additions and 33 deletions

View file

@ -0,0 +1,47 @@
<template>
<div>
<label>{{label}}</label>
<div class="uk-form-controls">
<div v-for="option in options" :key="option">
<label><input class="uk-checkbox" type="checkbox" v-bind:value="option" v-model="computedChecked"> {{ option }}</label>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'checkList',
props: [
'options',
'name',
'label',
'value'
],
data: function () {
return {
itemsChecked: this.value || []
}
},
computed: {
computedChecked: {
get() {
return this.itemsChecked
},
set(val) {
this.itemsChecked = val
this.$emit('input', this.itemsChecked)
}
}
}
}
</script>
<style scoped></style>