Browse Source

2024-1-5 数据字典组件封装优化

master
zelian_wu 2 years ago
parent
commit
870200fdac
  1. 15
      src/views/modules/sys/dict-data-select.vue

15
src/views/modules/sys/dict-data-select.vue

@ -27,10 +27,20 @@ export default {
options: [] options: []
} }
}, },
updated() {
this.dictDefaultValue()
},
created () { created () {
this.initOption() this.initOption()
}, },
methods: { methods: {
dictDefaultValue(){
// value ,value
if (!this.value && this.options.length > 0){
let find = this.options.find(item=>item.isDefault === 'Y');
this.$emit("change",find.dictValue);
}
},
//options //options
async initOption () { async initOption () {
// //
@ -44,11 +54,6 @@ export default {
if (data && data.code === 0){ if (data && data.code === 0){
this.options = data.rows; this.options = data.rows;
} }
// value ,value
if (!this.value && this.options.length > 0){
let find = this.options.find(item=>item.isDefault === 'Y');
this.$emit("change",find.dictValue);
}
}, },
// el-select @change, // el-select @change,
changeDictData(val){ changeDictData(val){

Loading…
Cancel
Save