element cascader选择器
关于项目遇到 级联选择器选择任意一项和关闭弹框
组件中的内容
<el-cascader
:options="category_list"
:show-all-levels="false"
:props="category_props"
v-model="releaseForm.category_id"
ref="elcascader"
@visible-change="handleElCascaderOnlick"
@expand-change="handleElCascaderOnlick"
placeholder="请选择订单分类"
/>
事件 handleElCascaderOnlick
let that = this;
setTimeout(function() {
document.querySelectorAll(".el-cascader-node__label").forEach(el => {
el.onclick = function() {
this.previousElementSibling.click();
that.$refs.elcascader.dropDownVisible = false;
};
});
document.querySelectorAll(".el-cascader-panel .el-radio").forEach(el => {
el.onclick = function() {
that.$refs.elcascader.dropDownVisible = false;
};
});
}, 100);
cascader 前面单选按钮隐藏
.el-cascader-panel .el-radio__input{
display: none;
}