el-cascader鼠标移除收起菜单
时间: 2023-08-20 07:05:44 浏览: 115
菜单项删除
5星 · 资源好评率100%
el-cascader鼠标移除时收起菜单的问题可以通过以下方式解决。在给cascader绑定鼠标移出事件时,判断当前移出的节点是否是一级菜单节点,并且没有子菜单存在。如果是这种情况,则隐藏二级菜单。具体代码如下所示:
```
cascaderBoundEvent() {
let cascaderMenus = document.querySelectorAll('.el-cascader-menu');
let cascaderNodes = document.querySelectorAll('.el-cascader-node');
for (let i = 0; i < cascaderNodes.length; i++) {
cascaderNodes[i].onmouseleave = (e) => {
if (!cascaderNodes[i].querySelector('.el-icon-arrow-right')) {
cascaderMenus<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [vue element el-Cascader 级联选择器 收起二级菜单的问题解决办法详解](https://blog.csdn.net/qq_36410795/article/details/101012869)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [elementUi cascader 级联动组件 hover 收起二级菜单](https://blog.csdn.net/QingWaXieZi/article/details/104382610)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文