ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

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

Open irenetang1993 opened 4 years ago

irenetang1993 commented 4 years ago

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

Reproduction Link

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

element-bot commented 4 years ago

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

Reproduction Link

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

chenjiangui commented 4 years ago

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

litt1e-p commented 4 years ago

same problem

stale[bot] commented 3 years ago

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.

hcqeric commented 3 years ago

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 }) } } ...... }