定义 Ref
<el-cascader
ref="positionRef"
v-model="item.positionId"
:options="positionOptions"
placeholder="请选择职位"
@change="(val:any)=>{positionChange(val,index)}"
:props="{
value: 'positionId',
label: 'positionName',
children: 'children',
checkStrictly: true,
}"/>
获取 Ref
const positionRef = ref([] as any);
let setPositionRef = (el: any) => {
if (el) {
positionRef.value.push(el);
}
};
使用 Ref
let positionChange = (e: any, index: any) => {
positionRef.value[index].togglePopperVisible();
};