|
@@ -9,7 +9,7 @@
|
|
|
:size="item.size ? item.size : size"
|
|
:size="item.size ? item.size : size"
|
|
|
|
|
|
|
|
:id="item[keys.id]"
|
|
:id="item[keys.id]"
|
|
|
- :checked="isOptionCheckedByDefault(item)"
|
|
|
|
|
|
|
+ :checked.sync="item.checked"
|
|
|
|
|
|
|
|
|
|
|
|
|
v-model="checkboxValues[index]"
|
|
v-model="checkboxValues[index]"
|
|
@@ -79,13 +79,29 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
ignoreChange: false,
|
|
ignoreChange: false,
|
|
|
checkboxValues: [],
|
|
checkboxValues: [],
|
|
|
- initialValue: JSON.parse(JSON.stringify(this.value))
|
|
|
|
|
|
|
+ initialValue: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
components: {
|
|
components: {
|
|
|
[nutcheckbox.name]: nutcheckbox
|
|
[nutcheckbox.name]: nutcheckbox
|
|
|
- },
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ watch:{
|
|
|
|
|
+ value(){
|
|
|
|
|
+ this.init();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted(){
|
|
|
|
|
+ this.init()
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ init(){
|
|
|
|
|
+ this.initialValue = this.value;
|
|
|
|
|
+ this.checkBoxData.map(item=>{
|
|
|
|
|
+ if(typeof item ==="object"){
|
|
|
|
|
+ item.checked = this.isOptionCheckedByDefault(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
isObject(obj) {
|
|
isObject(obj) {
|
|
|
return obj !== null && typeof obj === 'object';
|
|
return obj !== null && typeof obj === 'object';
|
|
|
},
|
|
},
|