@xilonglab/vue-main 1.3.20 → 1.3.23

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xilonglab/vue-main",
3
- "version": "1.3.20",
3
+ "version": "1.3.23",
4
4
  "description": "xilong vue main",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -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 options" :key="index" :label="option.value">{{
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 options" :key="index" :value="option.value">{{ option.label
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>
@@ -15,12 +15,8 @@ const props = defineProps({
15
15
 
16
16
  <template>
17
17
  <template v-for="col in columns" :key="col.prop">
18
- <slot
19
- v-if="col.slot"
20
- :name="col.slot"
21
- />
22
18
  <xl-form-col
23
- v-else-if="col.form"
19
+ v-if="col.form"
24
20
  :span="col.form.span"
25
21
  :l="col.label"
26
22
  :p="col.prop"
@@ -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>