element There is a problem with the implementation of the [bug report] dialog component destroy-on-close

mitkmikd  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(95)

Element UI version

2.14.1

OS/Browsers version

mac chrome

Vue version

2.6.12

https://codepen.io/CooberDing/pen/VwKydGN?editors=1111

Steps to reproduce

打开dialog,然后关闭dialog,注意观察控制台的log。
我根据源码发现,destroy-on-close的实现方式是 "this.key ++ "。相当于把""这个dom销毁了又重新创建了,导致我dialog内的组件的mounted声明周期在关闭dialog时被调用了,很诡异。

What is Expected?

dialog内节点被销毁

What is actually happening?

节点被销毁后又被创建出来

cclgggtu

cclgggtu1#

Translation of this issue:

Element UI version

2.14.1

OS/Browsers version

mac chrome

Vue version

2.6.12

https://codepen.io/CooberDing/pen/VwKydGN?editors=1111

Steps to reproduce

Open dialog, and then close it. Pay attention to the log of the console.
According to the source code, I found that the implementation of destroy on close is“ this.key "。 It's equivalent to destroying and re creating the DOM < div: key = "key" > < / div >, which causes the mounted declaration cycle of components in my dialog to be called when closing the dialog. It's very strange.

What is Expected?

The node in dialog is destroyed

What is actually happening?

The node was destroyed and came out again

ztigrdn8

ztigrdn82#

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.

qq24tv8q

qq24tv8q3#

Element UI version
2.15.6

OS/Browsers version
Windows11 edge

Vue version
2.6.12

destroy-on-close destreoyed trigger mounted

相关问题