|
|
@ -138,10 +138,16 @@ export default { |
|
|
|
// 当前选项是否选中 |
|
|
|
const isSelected = this.getValue(option) === this.selectedValue; |
|
|
|
|
|
|
|
// 选中状态下优先返回selectedLabel,其次返回labelKey指定的属性 |
|
|
|
return isSelected && option[this.selectedLabelKey] |
|
|
|
? option[this.selectedLabelKey] |
|
|
|
: option[this.labelKey] || option; |
|
|
|
// 选中状态下优先返回 selectedLabel |
|
|
|
if (isSelected && option[this.selectedLabelKey]) { |
|
|
|
return option[this.selectedLabelKey]; |
|
|
|
} |
|
|
|
|
|
|
|
// 明确检查 labelKey 是否存在 |
|
|
|
if (typeof option === 'object' && this.labelKey in option) { |
|
|
|
return option[this.labelKey]; |
|
|
|
} |
|
|
|
return option; |
|
|
|
}, |
|
|
|
getValue(option) { |
|
|
|
// 处理对象格式的选项 |
|
|
|