需求是控制可以多级选中的级联选择器选中单选框后自动隐藏下拉框。
<el-cascader
ref="safeTypes"
:disabled="isView"
:options="securityType"
v-model="safeTypes"
@change="getSafeType"
:props="{
label: 'dictName',
value: 'dictValue',
checkStrictly: true
}"
placeholder="请选择"
></el-cascader>
// js部分
getSafeType(arr: string[]) {
(this.$refs.safeTypes as any).dropDownVisible = false;
}
本文介绍了一种在级联选择器中实现选中项后自动隐藏下拉框的方法。通过修改级联选择器的显示状态,可以提升用户体验,特别是在单选场景下。使用 Vue.js 的 Element UI 组件库进行实现。
1329

被折叠的 条评论
为什么被折叠?



