乐趣区

关于vue3:elementui-plus怎么在级联选中后关闭弹层

<el-cascader
  v-model="form.productCategoryId"
  @change="classifyChange"
  :options="classify"
  :props="{ 
    checkStrictly: true, 
    value: 'categoryId', 
    label: 'categoryName', 
    expandTrigger: 'hover',
    emitPath: false,
  }"
  clearable
  :show-all-levels='false'
  ref='classifyRef'
>
</el-cascader>

定义一个 ref
const classifyRef = ref()

setup 外面

const classifyChange = () => {console.log(classifyRef.value)
  // 调用实例的办法手动敞开
  classifyRef.value.togglePopperVisible()}
退出移动版