Commit 5a6b4fbf authored by FuryBean's avatar FuryBean Committed by GitHub

Merge pull request #829 from Leopoldthecoder/select-value

Select: fix clear value & remote label
parents fea62257 845d716e
...@@ -243,6 +243,10 @@ ...@@ -243,6 +243,10 @@
this.inputLength = 20; this.inputLength = 20;
} }
} else { } else {
if (this.selectedInit) {
this.selectedInit = false;
return;
}
this.valueChangeBySelected = true; this.valueChangeBySelected = true;
this.$emit('input', val.value); this.$emit('input', val.value);
this.$emit('change', val.value); this.$emit('change', val.value);
...@@ -258,11 +262,9 @@ ...@@ -258,11 +262,9 @@
} }
if (this.remote && typeof this.remoteMethod === 'function') { if (this.remote && typeof this.remoteMethod === 'function') {
this.hoverIndex = -1; this.hoverIndex = -1;
if (!this.multiple) {
this.selected = {};
}
this.remoteMethod(val); this.remoteMethod(val);
this.voidRemoteQuery = val === ''; this.voidRemoteQuery = val === '';
this.broadcast('option', 'resetIndex');
} else if (typeof this.filterMethod === 'function') { } else if (typeof this.filterMethod === 'function') {
this.filterMethod(val); this.filterMethod(val);
} else { } else {
...@@ -358,6 +360,7 @@ ...@@ -358,6 +360,7 @@
this.resetHoverIndex(); this.resetHoverIndex();
} }
} else { } else {
this.selectedInit = !!init;
this.selected = option; this.selected = option;
this.selectedLabel = option.currentLabel; this.selectedLabel = option.currentLabel;
this.hoverIndex = option.index; this.hoverIndex = option.index;
...@@ -424,9 +427,6 @@ ...@@ -424,9 +427,6 @@
} }
if (!this.disabled) { if (!this.disabled) {
this.visible = !this.visible; this.visible = !this.visible;
if (this.remote && this.visible) {
this.selectedLabel = '';
}
} }
}, },
......
...@@ -203,11 +203,13 @@ describe('Pagination', () => { ...@@ -203,11 +203,13 @@ describe('Pagination', () => {
}); });
expect(vm.trigger).to.false; expect(vm.trigger).to.false;
setTimeout(_ => {
vm.$el.querySelectorAll('li.el-select-dropdown__item')[1].click(); vm.$el.querySelectorAll('li.el-select-dropdown__item')[1].click();
setTimeout(_ => { setTimeout(_ => {
expect(vm.trigger).to.true; expect(vm.trigger).to.true;
done(); done();
}, 50); }, 50);
}, 50);
}); });
it('pageSize > total', () => { it('pageSize > total', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment