DatePicker: fix the memory leak when showTime is set to true

pull/22712/head
yuhengshen 2023-10-20 11:25:28 +08:00
parent 290e68ea6a
commit c4d089d8ea
1 changed files with 7 additions and 1 deletions

View File

@ -610,6 +610,10 @@ export default {
this.$on('fieldReset', this.handleFieldReset); this.$on('fieldReset', this.handleFieldReset);
}, },
beforeDestroy() {
this.unmountPicker();
},
methods: { methods: {
focus() { focus() {
if (!this.ranged) { if (!this.ranged) {
@ -919,8 +923,10 @@ export default {
if (typeof this.unwatchPickerOptions === 'function') { if (typeof this.unwatchPickerOptions === 'function') {
this.unwatchPickerOptions(); this.unwatchPickerOptions();
} }
if (this.picker.$el.parentNode) {
this.picker.$el.parentNode.removeChild(this.picker.$el); this.picker.$el.parentNode.removeChild(this.picker.$el);
} }
}
}, },
emitChange(val) { emitChange(val) {