Commit 1b39f56967c7eac1a548d557accc230f3e039d42

Authored by Sergio Crisostomo
1 parent 4cccdf1f

Use label first if available

src/components/select/option.vue
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 return (this.label) ? this.label : this.value; 58 return (this.label) ? this.label : this.value;
59 }, 59 },
60 optionLabel(){ 60 optionLabel(){
61 - return (this.$el && this.$el.textContent) || this.label; 61 + return this.label || (this.$el && this.$el.textContent);
62 } 62 }
63 }, 63 },
64 methods: { 64 methods: {
src/components/select/select.vue
@@ -129,9 +129,10 @@ @@ -129,9 +129,10 @@
129 }; 129 };
130 130
131 const getOptionLabel = option => { 131 const getOptionLabel = option => {
  132 + if (option.componentOptions.propsData.label) return option.componentOptions.propsData.label;
132 const textContent = (option.componentOptions.children || []).reduce((str, child) => str + (child.text || ''), ''); 133 const textContent = (option.componentOptions.children || []).reduce((str, child) => str + (child.text || ''), '');
133 const innerHTML = getNestedProperty(option, 'data.domProps.innerHTML'); 134 const innerHTML = getNestedProperty(option, 'data.domProps.innerHTML');
134 - return option.componentOptions.propsData.label || textContent || (typeof innerHTML === 'string' ? innerHTML : ''); 135 + return textContent || (typeof innerHTML === 'string' ? innerHTML : '');
135 }; 136 };
136 137
137 138