Open tengmaoqing opened 4 years ago
Translation of this issue:
2.13.0
window 10 / chrome 81
2.6.11
https://codepen.io/tengmaoqing/pen/LYGWYwq?editors=1111
You can see that click button 1 first and click button 2 first
Button 2 is configured with closeonhashchange: false, which is inconsistent with the expectation
Closeonhashchange of different $confirm methods can take effect and should be consistent with the configuration
All $confirm's closeonhashchange behavior uses only the first $confirm configuration. Because $confirm always uses a message box component instance, and the hashchange event controlled by closeonhashchange is only added in mounted and removed in beforedestroy. As a result, all closeonhashchange configurations of $confirm and $alert take effect only when the first pop-up window is executed
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.
Element UI version
2.13.0
OS/Browsers version
window 10 / chrome 81
Vue version
2.6.11
Reproduction Link
https://codepen.io/tengmaoqing/pen/LYGWYwq?editors=1111
Steps to reproduce
可以看到先点击按钮1和先点击按钮2. 按钮2 配置了 closeOnHashChange: false,与期望不一致
What is Expected?
不同 $confirm方法的closeOnHashChange 都能生效,应该与配置一致
What is actually happening?
所有$confirm 的 closeOnHashChange 行为都只使用了第一个$confirm的配置。 因为 $confirm 始终使用的是一个 message-box 组件instance,而 closeOnHashChange控制的 hashChange 事件只在mounted中添加,beforeDestroy 中移除。导致了所有$confirm、$alert的closeOnHashChange 配置只有第一个执行的弹窗生效