@gindow/element-go 1.0.4 → 1.0.5

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.
@@ -1,44 +0,0 @@
1
- <template>
2
- <el-select v-model="value" v-bind="$attrs" filterable clearable @change="change">
3
- <el-option v-for="{ label, value } in dicts" :key="value" :label :value />
4
- </el-select>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- const props = defineProps({
9
- type: { type: String, required: true },
10
- })
11
-
12
- interface IDictItem {
13
- label: string
14
- value: string
15
- type?: string
16
- style?: string
17
- state?: number
18
- }
19
-
20
- const value = defineModel<string | number>({ default: '' })
21
-
22
- const emit = defineEmits(['change'])
23
-
24
- const dicts = ref<IDictItem[]>([])
25
-
26
- const load = async () => {
27
- try {
28
- // @ts-expect-error - api is globally injected by unplugin-auto-import
29
- const { data } = await api.guest().dictionaries({
30
- filter: { slug: props.type },
31
- include: 'dictionaries',
32
- })
33
- dicts.value = data?.[0]?.dictionaries?.map(({ label, value, type, style, state }: IDictItem) => ({
34
- label, value, type, style, state,
35
- })) ?? []
36
- } catch {
37
- dicts.value = []
38
- }
39
- }
40
-
41
- const change = (val: string | number) => emit('change', val)
42
-
43
- onMounted(() => load())
44
- </script>