Commit 1cd7dd8b3d9205e3f924ed51487535f28461c7b0

Authored by Aresn
Committed by GitHub
2 parents 4cccdf1f 1b39f569

Merge pull request #3742 from SergioCrisostomo/select-patches

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