Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] drawer设置destroyOnClose时,只在调用closeDrawer方法上会判断destroyOnClose并且销毁。通过visible改为false,虽然可以将弹窗关闭,但是并不会触发destroyOnClose判断且销毁的逻辑 #20339

Open
maogugu opened this issue Oct 27, 2020 · 1 comment
Labels

Comments

@maogugu
Copy link

maogugu commented Oct 27, 2020

Element UI version

2.6.3

OS/Browsers version

chrome

Vue version

2.6.10

Reproduction Link

https://codepen.io/pen/?&editable=true=https%3A%2F%2Felement.eleme.cn%2F

Steps to reproduce

根据源码element/packages/drawer/src/main.vue,closeDrawer方法会触发hide方法,并判断destroyOnClose 为true时,将rendered 置为false,通过el-drawer__body的v-if触发销毁。
而通过visible修改为false来关闭Drawer,只会触发watch,且visible改为false时,并不会判断destroyOnClose 及销毁的操作
附核心源码:

closeDrawer() {
if (typeof this.beforeClose === 'function') {
this.beforeClose(this.hide);
} else {
this.hide();
}
},
hide(cancel) {
if (cancel !== false) {
this.$emit('update:visible', false);
this.$emit('close');
if (this.destroyOnClose === true) {
this.rendered = false;
}
this.closed = true;
}
},

What is Expected?

通过visible修改为false来关闭Drawer,只会触发watch,且visible改为false时,可以增加destroyOnClose 及销毁的操作

What is actually happening?

通过visible修改为false来关闭Drawer,只会触发watch,且visible改为false时,并不会判断destroyOnClose 及销毁的操作

@zj9495 zj9495 mentioned this issue Jan 21, 2021
3 tasks
@stale
Copy link

stale bot commented Apr 18, 2022

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.

@stale stale bot added the stale label Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant