From cc1349eba9f4ccb3177e12229fc686b39f61cd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Thu, 6 Apr 2017 18:49:12 +0800 Subject: [PATCH] Select: fix single mode allow-create not working in Vue 2.2.x (#3984) --- packages/select/src/select.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/select/src/select.vue b/packages/select/src/select.vue index b538b57ce..9062ffe00 100644 --- a/packages/select/src/select.vue +++ b/packages/select/src/select.vue @@ -103,7 +103,6 @@ import { addClass, removeClass, hasClass } from 'element-ui/src/utils/dom'; import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event'; import { t } from 'element-ui/src/locale'; - import merge from 'element-ui/src/utils/merge'; const sizeMap = { 'large': 42, 'small': 30, @@ -197,7 +196,7 @@ return { options: [], cachedOptions: [], - createdOption: null, + createdLabel: null, createdSelected: false, selected: this.multiple ? [] : {}, isSelect: true, @@ -289,7 +288,7 @@ if (this.selected) { if (this.filterable && this.allowCreate && this.createdSelected && this.createdOption) { - this.selectedLabel = this.createdOption.currentLabel; + this.selectedLabel = this.createdLabel; } else { this.selectedLabel = this.selected.currentLabel; } @@ -396,7 +395,7 @@ if (!this.multiple) { let option = this.getOption(this.value); if (option.created) { - this.createdOption = merge({}, option); + this.createdLabel = option.currentLabel; this.createdSelected = true; } else { this.createdSelected = false;