element icon indicating copy to clipboard operation
element copied to clipboard

[Bug Report] Cascader getCheckedNodes 在搜索后,在触发的change事件中无法获取到选中的节点

Open robinwp opened this issue 6 years ago • 7 comments

Element UI version

2.9.2

OS/Browsers version

window10 chrome

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/robinwpzan/4tqvpcu7/4/

Steps to reproduce

搜索,选择一个节点,在change事件中,getCheckedNodes 方法获取选中的节点。 结果打印出选中的节点是空。 需要在this.$nextTick中调用getCheckedNodes 方法才能获取到节点信息

What is Expected?

能获取到当前选中的节点

What is actually happening?

不能获取到当前选中的节点

robinwp avatar Nov 26 '19 15:11 robinwp

Translation of this issue:

Element UI version

2.9.2

OS/Browsers version

window10 chrome

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/robinwpzan/4tqvpcu7/4/

Steps to reproduce

Search, select a node, in the change event, getcheckednodes method gets the selected node.

The result prints out that the selected node is empty. You need to call the getCheckedNodes method in this.$nextTick to get the node information.

What is Expected?

Can get the currently selected node

What is actually happening?

Cannot get the currently selected node

element-bot avatar Nov 26 '19 15:11 element-bot

I have common problem

5265liu avatar Mar 23 '20 12:03 5265liu

https://github.com/ElemeFE/element/blob/1b1c1beadc9333e7b210d424db465a18f8b19995/packages/cascader-panel/src/cascader-panel.vue#L154

you may invoke getCheckedNodes method of cascader on change when you set the filterable mode. In fact, getCheckedNodes method of cascader invoke a method with the same name of cascader-panel At that time, checkedValue of cascader has been updated but checkedValue of cascader-panel hasn't.

9-lives avatar Mar 27 '20 06:03 9-lives

same problem

fidding avatar Jun 16 '20 02:06 fidding

same problem

Hazelwu2 avatar Apr 01 '21 14:04 Hazelwu2

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.

stale[bot] avatar Apr 16 '22 14:04 stale[bot]

handleChange(value) { this.$nextTick(() => { this.$refs['cascader'].getCheckedNodes() }) }

lihongwang avatar Jun 03 '24 05:06 lihongwang