Select: fix clear on remote mode

pull/1369/head
kingwl 2016-11-25 15:10:29 +08:00 committed by 杨奕
parent 2f37355136
commit e44bf50e5d
1 changed files with 12 additions and 9 deletions

View File

@ -97,16 +97,19 @@
let criteria = this.clearable && this.inputHovering && !this.multiple && this.options.indexOf(this.selected) > -1; let criteria = this.clearable && this.inputHovering && !this.multiple && this.options.indexOf(this.selected) > -1;
if (!this.$el) return false; if (!this.$el) return false;
let icon = this.$el.querySelector('.el-input__icon'); this.$nextTick(() => {
if (icon) { let icon = this.$el.querySelector('.el-input__icon');
if (criteria) { if (icon) {
icon.addEventListener('click', this.deleteSelected); if (criteria) {
addClass(icon, 'is-show-close'); icon.addEventListener('click', this.deleteSelected);
} else { addClass(icon, 'is-show-close');
icon.removeEventListener('click', this.deleteSelected); } else {
removeClass(icon, 'is-show-close'); icon.removeEventListener('click', this.deleteSelected);
removeClass(icon, 'is-show-close');
}
} }
} });
return criteria; return criteria;
}, },