From 2f37355136d55a424a95183ee894ed632a44695e Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 25 Nov 2016 14:06:53 +0800 Subject: [PATCH] Select: fix priority of label and value --- packages/select/src/option.vue | 4 ++++ packages/select/src/select.vue | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/select/src/option.vue b/packages/select/src/option.vue index 9b26cf27a..7fa4225f6 100644 --- a/packages/select/src/option.vue +++ b/packages/select/src/option.vue @@ -50,6 +50,10 @@ return this.label || ((typeof this.value === 'string' || typeof this.value === 'number') ? this.value : ''); }, + currentValue() { + return this.value || this.label || ''; + }, + parent() { let result = this.$parent; while (!result.isSelect) { diff --git a/packages/select/src/select.vue b/packages/select/src/select.vue index 842b819b0..111a0f68c 100644 --- a/packages/select/src/select.vue +++ b/packages/select/src/select.vue @@ -421,7 +421,7 @@ } else { let optionIndex = -1; this.selected.forEach((item, index) => { - if (item === option || item.currentLabel === option.currentLabel) { + if (item === option || item.currentValue === option.currentValue) { optionIndex = index; } });