|
|
@ -30,6 +30,11 @@ export default { |
|
|
|
type: String, |
|
|
|
default: 'label' |
|
|
|
}, |
|
|
|
// 新增动态添加项的配置 |
|
|
|
extraItem: { |
|
|
|
type: Object, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
styleObject: Object, |
|
|
|
disabled: Boolean, |
|
|
|
required: Boolean, |
|
|
@ -55,7 +60,19 @@ export default { |
|
|
|
computed: { |
|
|
|
// 处理options为空的情况 |
|
|
|
processedOptions() { |
|
|
|
return this.options || [] |
|
|
|
let options = this.options || []; |
|
|
|
// 当extraItem存在且不是空对象时,添加到options数组开头 |
|
|
|
if (this.extraItem && Object.keys(this.extraItem).length > 0) { |
|
|
|
return [ |
|
|
|
{ |
|
|
|
[this.labelKey]: this.extraItem.label || '', |
|
|
|
[this.valueKey]: this.extraItem.value || '', |
|
|
|
disabled: this.extraItem.disabled || false |
|
|
|
}, |
|
|
|
...options |
|
|
|
]; |
|
|
|
} |
|
|
|
return options; |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|