Commit 1f24f7a3 authored by 何虹's avatar 何虹 💬

修复复选组bug

parent 126313a7
......@@ -9,7 +9,7 @@
</template>
<script>
import HelloWorld from "./components/hsTable.vue";
import HelloWorld from "./components/HelloWorld.vue";
export default {
name: "App",
......
......@@ -8,6 +8,10 @@
></hsSelectPlus>
<el-button @click="change1">change1</el-button>
<el-button @click="change2">change2</el-button>
<hsCheckboxGroup
v-model="checkList"
:allSourceData='configData'
></hsCheckboxGroup>
</div>
</template>
......@@ -17,6 +21,7 @@ export default {
mixins: [uc],
data() {
return {
checkList:'B,A',
selectValue: "1052069380861628416",
allSourceData: {
config: {
......@@ -42,7 +47,7 @@ export default {
label: "name",
is_computed: false
},
sourceData: [],
sourceData: []
},
show: false,
config: {
......@@ -66,6 +71,17 @@ export default {
value: "id",
label: "name",
is_computed: false
},
configData: {
sourceData: [
{
label: "A"
},
{
label: "B"
}
],
config: {}
}
};
},
......@@ -75,7 +91,7 @@ export default {
},
change2() {
this.allSourceData.sourceData = [{ value: 2, label: 3 }];
},
}
}
};
</script>
\ No newline at end of file
......@@ -6,8 +6,8 @@
<div class="inputCurr">
<el-checkbox-group v-model="value_inner">
<el-checkbox
v-for="(item,index) in dataList"
:key='index'
v-for="(item) in dataList"
:key='item.label'
:label='item.label'
:disabled='item.disabled'
>
......@@ -65,16 +65,22 @@ export default {
deep: true
},
value(val) {
this.value_inner = val;
this.initValue()
},
value_inner(val) {
this.$emit("input", val);
let value_ = [];
if (typeof val === "string") {
value_ = val.join();
} else {
value_ = val;
}
this.$emit("input", value_);
}
},
data() {
return {
elId: "",
value_inner: "",
value_inner: [],
jsoneditorVisible: false,
configData: {
title: ""
......@@ -84,11 +90,19 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.initValue()
const { config, sourceData } = this.allSourceData;
this.initConfigData(config, sourceData);
});
},
methods: {
initValue(){
if (typeof this.value === "string") {
this.value_inner = this.value.split(",");
} else {
this.value_inner = this.value;
}
},
initConfigData(config, sourceData) {
this.initConfig(_.cloneDeep(config));
this.initData(_.cloneDeep(sourceData));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment