You can refer to the article: (33 messages) Antd-desgin-vue drop-down selection change event passes custom parameters_vue passes value every time the content of the drop-down selection changes_Just have your blog-CSDN blog
<a-tree-select
v-show="treeDatas[index] && treeDatas[index].length>0"
:getPopupContainer="(triggerNode) => triggerNode.parentNode"
:replace-fields="{ key: 'key', value: 'id' }"
@change="(value, label, extra) => {menuIdsChange(value, label, extra, index);}"
v-model="menuIds[index]"
style="width: 100%"
:tree-data="treeDatas[index]"
tree-checkable
:show-checked-strategy="SHOW_ALL"
search-placeholder="请选择"
placeholder="请选择菜单"
/>
methods:
// treeSelect改变触发该函数
// 同时使用value、label、extra 和 index 四个参数注意参数写法
menuIdsChange(value, label, extra, index) {
let that = this
console.log('this.menuIds[index]', this.menuIds[index])
debugger
let parentId = extra.triggerNode.$options.parent.$vnode.data.props.id
if( this.menuIds){
// 看父元素是否已在menuIds中
}
},