Merge pull request #2890 from yangdan8/patch-6

解决select-item引起的大量内存泄漏的bug
This commit is contained in:
Aresn 2018-01-23 14:12:14 +08:00 committed by GitHub
commit 037de0520c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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>