From 1b39f56967c7eac1a548d557accc230f3e039d42 Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Tue, 29 May 2018 08:40:45 +0200 Subject: [PATCH] Use label first if available --- src/components/select/option.vue | 2 +- src/components/select/select.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/select/option.vue b/src/components/select/option.vue index a8b6088..59e080f 100644 --- a/src/components/select/option.vue +++ b/src/components/select/option.vue @@ -58,7 +58,7 @@ return (this.label) ? this.label : this.value; }, optionLabel(){ - return (this.$el && this.$el.textContent) || this.label; + return this.label || (this.$el && this.$el.textContent); } }, methods: { diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 740e8f8..ea1f5d1 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -129,9 +129,10 @@ }; const getOptionLabel = option => { + if (option.componentOptions.propsData.label) return option.componentOptions.propsData.label; const textContent = (option.componentOptions.children || []).reduce((str, child) => str + (child.text || ''), ''); const innerHTML = getNestedProperty(option, 'data.domProps.innerHTML'); - return option.componentOptions.propsData.label || textContent || (typeof innerHTML === 'string' ? innerHTML : ''); + return textContent || (typeof innerHTML === 'string' ? innerHTML : ''); }; -- libgit2 0.21.4