解决select-item引起的大量内存泄漏的bug
解决select-item引起的大量内存泄漏的bug
This commit is contained in:
parent
5dc44ccf9b
commit
6d017f5a6d
1 changed files with 10 additions and 6 deletions
|
@ -67,23 +67,27 @@
|
||||||
// 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865
|
// 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865
|
||||||
updateSearchLabel () {
|
updateSearchLabel () {
|
||||||
this.searchLabel = this.$el.textContent;
|
this.searchLabel = this.$el.textContent;
|
||||||
|
},
|
||||||
|
onSelectClose(){
|
||||||
|
this.isFocus = false;
|
||||||
|
},
|
||||||
|
onQueryChange(val){
|
||||||
|
this.queryChange(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.updateSearchLabel();
|
this.updateSearchLabel();
|
||||||
this.dispatch('iSelect', 'append');
|
this.dispatch('iSelect', 'append');
|
||||||
this.$on('on-select-close', () => {
|
this.$on('on-select-close', this.onSelectClose);
|
||||||
this.isFocus = false;
|
this.$on('on-query-change',this.onQueryChange);
|
||||||
});
|
|
||||||
this.$on('on-query-change', (val) => {
|
|
||||||
this.queryChange(val);
|
|
||||||
});
|
|
||||||
|
|
||||||
const Select = findComponentUpward(this, 'iSelect');
|
const Select = findComponentUpward(this, 'iSelect');
|
||||||
if (Select) this.autoComplete = Select.autoComplete;
|
if (Select) this.autoComplete = Select.autoComplete;
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.dispatch('iSelect', 'remove');
|
this.dispatch('iSelect', 'remove');
|
||||||
|
this.$off('on-select-close', this.onSelectClose);
|
||||||
|
this.$off('on-query-change',this.onQueryChange);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue