Merge pull request #1828 from SergioCrisostomo/fix-context-for-debounce
fix debounce context
This commit is contained in:
commit
364aac0217
1 changed files with 16 additions and 14 deletions
|
@ -624,18 +624,20 @@
|
||||||
this.broadcast('iOption', 'on-query-change', val);
|
this.broadcast('iOption', 'on-query-change', val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
debouncedAppendRemove: debounce(function(){
|
debouncedAppendRemove(){
|
||||||
if (!this.remote) {
|
return debounce(function(){
|
||||||
this.modelToQuery();
|
if (!this.remote) {
|
||||||
this.$nextTick(() => this.broadcastQuery(''));
|
this.modelToQuery();
|
||||||
} else {
|
this.$nextTick(() => this.broadcastQuery(''));
|
||||||
this.findChild((child) => {
|
} else {
|
||||||
child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value;
|
this.findChild((child) => {
|
||||||
});
|
child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value;
|
||||||
}
|
});
|
||||||
this.slotChange();
|
}
|
||||||
this.updateOptions(true, true);
|
this.slotChange();
|
||||||
}),
|
this.updateOptions(true, true);
|
||||||
|
});
|
||||||
|
},
|
||||||
// 处理 remote 初始值
|
// 处理 remote 初始值
|
||||||
updateLabel () {
|
updateLabel () {
|
||||||
if (this.remote) {
|
if (this.remote) {
|
||||||
|
@ -669,8 +671,8 @@
|
||||||
this.updateOptions(true);
|
this.updateOptions(true);
|
||||||
document.addEventListener('keydown', this.handleKeydown);
|
document.addEventListener('keydown', this.handleKeydown);
|
||||||
|
|
||||||
this.$on('append', this.debouncedAppendRemove);
|
this.$on('append', this.debouncedAppendRemove());
|
||||||
this.$on('remove', this.debouncedAppendRemove);
|
this.$on('remove', this.debouncedAppendRemove());
|
||||||
|
|
||||||
this.$on('on-select-selected', (value) => {
|
this.$on('on-select-selected', (value) => {
|
||||||
if (this.model === value) {
|
if (this.model === value) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue