【修改】修复字典多选数据更新代码不更新的bug

This commit is contained in:
zer0Black
2022-04-17 21:46:28 +08:00
parent 7ce4d0547c
commit 613ce9d31c
@@ -13,15 +13,16 @@
:getPopupContainer="getParentContainer" :getPopupContainer="getParentContainer"
optionFilterProp="children" optionFilterProp="children"
:filterOption="filterOption" :filterOption="filterOption"
allowClear> allowClear
<a-select-option :options="dictOptions">
v-for="(item,index) in dictOptions" <!-- <a-select-option-->
:key="index" <!-- v-for="(item,index) in dictOptions"-->
:value="item.value"> <!-- :key="index"-->
<span style="display: inline-block;width: 100%" :title=" item.text || item.label "> <!-- :value="item.value">-->
{{ item.text || item.label }} <!-- <span style="display: inline-block;width: 100%" :title=" item.text || item.label ">-->
</span> <!-- {{ item.text || item.label }}-->
</a-select-option> <!-- </span>-->
<!-- </a-select-option>-->
</a-select> </a-select>
</template> </template>
@@ -62,11 +63,13 @@
this.tagType = this.type this.tagType = this.type
} }
//获取字典数据 //获取字典数据
//this.initDictData(); // this.initDictData();
}, },
watch:{ watch:{
options: function(val){ options (val) {
this.setCurrentDictOptions(val); val.forEach((item, index) => {
this.$set(this.dictOptions, index, item)
})
}, },
dictCode:{ dictCode:{
immediate:true, immediate:true,
@@ -103,14 +106,8 @@
}, },
onChange (selectedValue) { onChange (selectedValue) {
this.value = selectedValue.join(this.spliter); this.arrayValue = selectedValue;
this.$emit('change', this.value); this.$emit('change', selectedValue.join(this.spliter));
},
setCurrentDictOptions(dictOptions){
this.dictOptions = dictOptions
},
getCurrentDictOptions(){
return this.dictOptions
}, },
getParentContainer(node){ getParentContainer(node){
if(!this.popContainer){ if(!this.popContainer){