element [Bug Report] reassign expand-row-keys would keep the previous expanded rows still expanded

hmtdttj4  于 2022-10-23  发布在  其他
关注(0)|答案(5)|浏览(143)

Element UI version

2.13.0

OS/Browsers version

macOS 10.14.3 / chrome 版本 80.0.3987.132

Vue version

3.0.0-alpha.7

https://codepen.io/xiaobeizi/pen/RwPjbqK?editable=true

Steps to reproduce

At first set the expand-row-keys to ['3'],after 3 seconds reassign the expand-row-keys to ['1']

What is Expected?

only row['1'] is expanded

What is actually happening?

both row['3'] and row['1'] are expanded

ryoqjall

ryoqjall1#

Translation of this issue:

Element UI version

2.13.0

OS/Browsers version

Mac OS 10.14.3 / Chrome version 80.0.3987.132

Vue version

3.0.0-alpha.7

https://codepen.io/xiaobeizi/pen/RwPjbqK?editable=true

Steps to reproduce

At first set the expand-row-keys to ['3'],after 3 seconds reassign the expand-row-keys to ['1']

What is Expected?

only row['1'] is expanded

What is actually happening?

both row['3'] and row['1'] are expanded

4xy9mtcn

4xy9mtcn2#

2.13.1也是这样, 只能展开 无法闭合

jm2pwxwz

jm2pwxwz4#

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.

vktxenjb

vktxenjb5#

same problem, but it worked after re-render. I use v-if='isRerender' to the table (isRerender default value with true) and in the expand-change method only when there are values in the expand-row-keys to use isRerender to let the table rerender then it worked:
code like:
handleExpandChange(row, expand) {
......
if(expand) {
if(expandRowKeys.length){
isRerender = false
this.$nextTick(()=>{
......
isRerender = true
})
}
}
......
}

相关问题