@xilonglab/vue-main 1.3.19 → 1.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/form/XlSelect.vue +12 -0
package/package.json
CHANGED
|
@@ -18,6 +18,10 @@ const props = defineProps({
|
|
|
18
18
|
type: [Array, Object], // Allow both Array and Ref<Array>
|
|
19
19
|
default: () => [],
|
|
20
20
|
},
|
|
21
|
+
labels: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => null,
|
|
24
|
+
},
|
|
21
25
|
disabled: {
|
|
22
26
|
type: Boolean,
|
|
23
27
|
default: false,
|
|
@@ -53,6 +57,14 @@ const value = computed({
|
|
|
53
57
|
});
|
|
54
58
|
|
|
55
59
|
const resolvedOptions = computed(() => {
|
|
60
|
+
// 如果 labels 存在,将其转换为 options 格式
|
|
61
|
+
if (props.labels && props.labels.length > 0) {
|
|
62
|
+
return props.labels.map(label => ({
|
|
63
|
+
label: label,
|
|
64
|
+
value: label,
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
// 否则使用原来的 options
|
|
56
68
|
return props.options.value ? props.options.value : props.options;
|
|
57
69
|
});
|
|
58
70
|
</script>
|