element icon indicating copy to clipboard operation
element copied to clipboard

[Bug Report] About the issue of "initial-index" property can not be set dynamically on "el-doalog" nested "el-carousel"

Open AllenTank opened this issue 8 years ago • 4 comments

Element UI version

2.0.9

OS/Browsers version

Windows 7旗舰版 / Chrome 版本 59.0.3071.115(正式版本) (32 位)

Vue version

2.5.13

Reproduction Link

https://jsfiddle.net/Lse8kkwf/

Steps to reproduce

点击图片列表任意一张图片时,设置走马灯的“initial-index”为当前图片的index

What is Expected?

点击图片列表任意一张图片时,设置走马灯的“initial-index”为当前图片的index

What is actually happening?

点击图片列表任意一张图片时,设置走马灯的“initial-index”为当前图片的index后,实际的“initial-index”不是当前图片的index

AllenTank avatar Dec 29 '17 06:12 AllenTank

https://jsfiddle.net/vwxcszzx/实现了期望效果

AllenTank avatar Dec 29 '17 07:12 AllenTank

原因是el-doalog的隐藏显示是用的v-show,未删除dom,而el-carousel的initial-index属性只是设置初始index。若要动态设置el-carousel的initial-index,需要给el-carousel添加v-if来重新渲染dom,以达到重新设置el-carousel的initial-index的目的。

AllenTank avatar Dec 29 '17 07:12 AllenTank

是的。

Leopoldthecoder avatar Dec 31 '17 01:12 Leopoldthecoder

initial-index 希望能做到sync

guohuihot avatar Apr 28 '19 09:04 guohuihot