[Bug Report] drawer设置destroyOnClose时,只在调用closeDrawer方法上会判断destroyOnClose并且销毁。通过visible改为false,虽然可以将弹窗关闭,但是并不会触发destroyOnClose判断且销毁的逻辑
- Dominant language
- Vue
- Stars
- 54k
- Forks
- 14.4k
- PR merge metrics
- No merged PRs in 30d
Description
### 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 及销毁的操作
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.