1、对a-tree-select组件的props属性向下透传

2、a-tree-select组件的事件全部向上暴露
This commit is contained in:
yaoyanan
2021-04-06 18:06:13 +08:00
parent f0c601ad09
commit 6743281d9f
6 changed files with 49 additions and 32 deletions
+15 -7
View File
@@ -14,6 +14,8 @@
:treeData="treeData"
:multiple="multiple"
:show-search="!multiple"
v-bind="_attrs"
v-on="$listeners"
@change="onChange">
</a-tree-select>
<a-tree-select
@@ -29,6 +31,8 @@
:treeData="treeData"
:multiple="multiple"
:show-search="!multiple"
v-bind="_attrs"
v-on="$listeners"
@change="onChange">
</a-tree-select>
</div>
@@ -49,10 +53,10 @@
required:false,
default:true
},
value:{
type: String,
required: false
},
// value:{
// type: String,
// required: false
// },
placeholder:{
type: String,
default: '请选择',
@@ -119,6 +123,13 @@
this.loadRoot()
}
},
computed:{
_attrs() {
let attrs
attrs = { ...this.$attrs }
return attrs
}
},
created(){
this.validateProp().then(()=>{
this.initDictInfo()
@@ -251,15 +262,12 @@
},
onChange(value){
if(!value){
this.$emit('change', '');
this.treeValue = null
} else if (value instanceof Array) {
//多选
this.$emit('change', value.join(',').toString()) //修改第一次选中时,选中为空的情况
this.treeValue = value
} else {
//单选
this.$emit('change', value)
this.treeValue = value
}
},