Commit cc1349eb authored by 杨奕's avatar 杨奕 Committed by baiyaaaaa

Select: fix single mode allow-create not working in Vue 2.2.x (#3984)

parent d4ab75c9
...@@ -103,7 +103,6 @@ ...@@ -103,7 +103,6 @@
import { addClass, removeClass, hasClass } from 'element-ui/src/utils/dom'; import { addClass, removeClass, hasClass } from 'element-ui/src/utils/dom';
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event'; import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
import { t } from 'element-ui/src/locale'; import { t } from 'element-ui/src/locale';
import merge from 'element-ui/src/utils/merge';
const sizeMap = { const sizeMap = {
'large': 42, 'large': 42,
'small': 30, 'small': 30,
...@@ -197,7 +196,7 @@ ...@@ -197,7 +196,7 @@
return { return {
options: [], options: [],
cachedOptions: [], cachedOptions: [],
createdOption: null, createdLabel: null,
createdSelected: false, createdSelected: false,
selected: this.multiple ? [] : {}, selected: this.multiple ? [] : {},
isSelect: true, isSelect: true,
...@@ -289,7 +288,7 @@ ...@@ -289,7 +288,7 @@
if (this.selected) { if (this.selected) {
if (this.filterable && this.allowCreate && if (this.filterable && this.allowCreate &&
this.createdSelected && this.createdOption) { this.createdSelected && this.createdOption) {
this.selectedLabel = this.createdOption.currentLabel; this.selectedLabel = this.createdLabel;
} else { } else {
this.selectedLabel = this.selected.currentLabel; this.selectedLabel = this.selected.currentLabel;
} }
...@@ -396,7 +395,7 @@ ...@@ -396,7 +395,7 @@
if (!this.multiple) { if (!this.multiple) {
let option = this.getOption(this.value); let option = this.getOption(this.value);
if (option.created) { if (option.created) {
this.createdOption = merge({}, option); this.createdLabel = option.currentLabel;
this.createdSelected = true; this.createdSelected = true;
} else { } else {
this.createdSelected = false; this.createdSelected = false;
......
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