Merge pull request #3742 from SergioCrisostomo/select-patches
Use label first if available
This commit is contained in:
commit
1cd7dd8b3d
2 changed files with 3 additions and 2 deletions
|
@ -58,7 +58,7 @@
|
||||||
return (this.label) ? this.label : this.value;
|
return (this.label) ? this.label : this.value;
|
||||||
},
|
},
|
||||||
optionLabel(){
|
optionLabel(){
|
||||||
return (this.$el && this.$el.textContent) || this.label;
|
return this.label || (this.$el && this.$el.textContent);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -129,9 +129,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const getOptionLabel = option => {
|
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 textContent = (option.componentOptions.children || []).reduce((str, child) => str + (child.text || ''), '');
|
||||||
const innerHTML = getNestedProperty(option, 'data.domProps.innerHTML');
|
const innerHTML = getNestedProperty(option, 'data.domProps.innerHTML');
|
||||||
return option.componentOptions.propsData.label || textContent || (typeof innerHTML === 'string' ? innerHTML : '');
|
return textContent || (typeof innerHTML === 'string' ? innerHTML : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue