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

修复复选组bug

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