Element: [Feature Request] cascader cascade selector assembly hover expansion, click selected.

Created on 5 May 2017  ·  7Comments  ·  Source: ElemeFE/element

Existing Component

Yes

Component Name

el-cascader

Description

开启change-on-select选项后,希望有hover切换但不选中、用click选中的功能。目前只支持click或者hover切换并选中。

cascader stale

Most helpful comment

经过几个小时的奋斗,可以不修改源码的前提下实现该功能
利用elementUI提供的active-item-change 获取当前的选择的路径数组pathArray
通过绑定当前事件,构造出select(item, menuIndex)需要的数据结构
item:{
value: 1,
label: 'xxx'
}
menuIndex = pathArray.length - 1

image
image
这就可以实现hover展开,click选中的效果

All 7 comments

Translation of this issue:

Existing Component

Yes

Component Name

El-cascader

Description

After opening the change-on-select option, I hope to have a hover switch but not selected, with the click selected function. Currently only supports click or hover switch and select.

确实对change-on-select选项开启之后,整个el-cascader选择体验非常不好。
选择一个中间选项后,只能移出焦点才会选择成功,这样会给人造成误解必须选择完整路径才算完成,然而这样根本不符合官网说明的点击或移入选项即表示选中该项,可用于选择任意一级菜单的选项。虽然是从体验的角度上,但是确实需求不能完整体现。

在官方解决之前的临时代替方法, 用DOM事件转接使其自动展开.
el-dd

https://www.topcl.net/programming-experience/vue-element-ui-selector-cascader-mouseover-auto-expand.html

这个体验真的是挺希望他可以实现,我可以自己通过修改他的源码实现这个修改
image
但是毕竟是修改源码,我们element安装都是通过npm,这样的话,他人接手就不知道这个功能点,更多的说明都没有用。

经过几个小时的奋斗,可以不修改源码的前提下实现该功能
利用elementUI提供的active-item-change 获取当前的选择的路径数组pathArray
通过绑定当前事件,构造出select(item, menuIndex)需要的数据结构
item:{
value: 1,
label: 'xxx'
}
menuIndex = pathArray.length - 1

image
image
这就可以实现hover展开,click选中的效果

刚好有这个需求,感谢大佬!@JuneM

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings