@xilonglab/vue-main 1.3.19 → 1.3.21
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
CHANGED
|
@@ -13,6 +13,10 @@ const props = defineProps({
|
|
|
13
13
|
type: Array,
|
|
14
14
|
default: () => [],
|
|
15
15
|
},
|
|
16
|
+
labels: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => null,
|
|
19
|
+
},
|
|
16
20
|
max: {
|
|
17
21
|
type: Number,
|
|
18
22
|
default: 1,
|
|
@@ -31,12 +35,24 @@ const value = computed({
|
|
|
31
35
|
emits('change', data)
|
|
32
36
|
},
|
|
33
37
|
});
|
|
38
|
+
|
|
39
|
+
const resolvedOptions = computed(() => {
|
|
40
|
+
// 如果 labels 存在,将其转换为 options 格式
|
|
41
|
+
if (props.labels && props.labels.length > 0) {
|
|
42
|
+
return props.labels.map(label => ({
|
|
43
|
+
label: label,
|
|
44
|
+
value: label,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
// 否则使用原来的 options
|
|
48
|
+
return props.options;
|
|
49
|
+
});
|
|
34
50
|
</script>
|
|
35
51
|
|
|
36
52
|
|
|
37
53
|
<template>
|
|
38
54
|
<el-checkbox-group class="xl-checkbox-group" v-model="value" :max="max">
|
|
39
|
-
<el-checkbox class="xl-checkbox" v-for="(option, index) in
|
|
55
|
+
<el-checkbox class="xl-checkbox" v-for="(option, index) in resolvedOptions" :key="index" :label="option.value">{{
|
|
40
56
|
option.label }}</el-checkbox>
|
|
41
57
|
</el-checkbox-group>
|
|
42
58
|
</template>
|
|
@@ -17,6 +17,10 @@ const props = defineProps({
|
|
|
17
17
|
return [];
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
labels: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default: () => null,
|
|
23
|
+
},
|
|
20
24
|
})
|
|
21
25
|
|
|
22
26
|
const value = computed({
|
|
@@ -28,12 +32,24 @@ const value = computed({
|
|
|
28
32
|
emits('update:modelValue', data)
|
|
29
33
|
},
|
|
30
34
|
});
|
|
35
|
+
|
|
36
|
+
const resolvedOptions = computed(() => {
|
|
37
|
+
// 如果 labels 存在,将其转换为 options 格式
|
|
38
|
+
if (props.labels && props.labels.length > 0) {
|
|
39
|
+
return props.labels.map(label => ({
|
|
40
|
+
label: label,
|
|
41
|
+
value: label,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
// 否则使用原来的 options
|
|
45
|
+
return props.options;
|
|
46
|
+
});
|
|
31
47
|
</script>
|
|
32
48
|
|
|
33
49
|
|
|
34
50
|
<template>
|
|
35
51
|
<el-radio-group class="xl-radio" v-model="value">
|
|
36
|
-
<el-radio v-for="(option, index) in
|
|
52
|
+
<el-radio v-for="(option, index) in resolvedOptions" :key="index" :value="option.value">{{ option.label
|
|
37
53
|
}}</el-radio>
|
|
38
54
|
</el-radio-group>
|
|
39
55
|
</template>
|
|
@@ -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>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
defineOptions({ name: "XlRawSelect" })
|
|
3
|
-
|
|
4
|
-
import { ref, computed } from 'vue';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const emits = defineEmits(['change', 'update:modelValue'])
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
modelValue: {
|
|
11
|
-
default: '',
|
|
12
|
-
},
|
|
13
|
-
labels: {
|
|
14
|
-
type: Array,
|
|
15
|
-
default: () => [],
|
|
16
|
-
},
|
|
17
|
-
disabled: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false,
|
|
20
|
-
},
|
|
21
|
-
width: {
|
|
22
|
-
default: 100,
|
|
23
|
-
},
|
|
24
|
-
multiple: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
placeholder: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: '',
|
|
31
|
-
},
|
|
32
|
-
allowCreate: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const visible = ref(true)
|
|
40
|
-
|
|
41
|
-
const value = computed({
|
|
42
|
-
get() {
|
|
43
|
-
return props.modelValue;
|
|
44
|
-
},
|
|
45
|
-
set(data) {
|
|
46
|
-
emits('change', data)
|
|
47
|
-
emits('update:modelValue', data)
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<el-select v-if="visible" class="xl-raw-select xl-form-item" v-model="value" :placeholder="placeholder"
|
|
55
|
-
:disabled="disabled" :style="{ width: `${width}px` }" :multiple="multiple" clearable>
|
|
56
|
-
<el-option v-for="(label, index) in labels" :key="index" :value="label">
|
|
57
|
-
{{ label }}
|
|
58
|
-
</el-option>
|
|
59
|
-
</el-select>
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<style lang="less" scoped>
|
|
64
|
-
.el-select {
|
|
65
|
-
margin: 3px 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.el-input__inner {
|
|
69
|
-
padding: 0 5px !important;
|
|
70
|
-
}
|
|
71
|
-
</style>
|