Added strict one-way binding to all form components
This commit is contained in:
parent
4a0351f80c
commit
5e69e52bcd
8 changed files with 181 additions and 33 deletions
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue