@xuekl/cli-components 1.3.5 → 1.3.6

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.
Files changed (2) hide show
  1. package/XklDict.vue +10 -1
  2. package/package.json +1 -1
package/XklDict.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-select style="width: 100%;">
2
+ <el-select style="width: 100%;" @change="changeHandle">
3
3
  <el-option v-for="item in dataList" :key="item.dictValue" :label="item.dictLabel"
4
4
  :value="item.dictValue"></el-option>
5
5
  </el-select>
@@ -14,9 +14,17 @@ import { ref, onBeforeMount, Ref } from 'vue'
14
14
  import http from "@/utils/httpRequest"
15
15
  import { baseConfig } from "@xuekl/cli-base/config"
16
16
  const props = defineProps(['config'])
17
+ const emit = defineEmits(['update:label', 'loaded'])
18
+
17
19
  const { config } = props
18
20
  const dataList: Ref<{ dictCode: string, dictLabel: string, dictValue: string | number }[]> = ref([])
19
21
 
22
+ const changeHandle = (val: string) => {
23
+ const item = dataList.value.find(res => res.dictValue === val)
24
+ if (item) {
25
+ emit('update:label', item.dictLabel)
26
+ }
27
+ }
20
28
 
21
29
  onBeforeMount(() => {
22
30
  http({
@@ -25,6 +33,7 @@ onBeforeMount(() => {
25
33
  params: http.adornParams({})
26
34
  }).then(({ data }) => {
27
35
  dataList.value = data.data
36
+ emit('loaded', dataList.value)
28
37
  })
29
38
  })
30
39
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuekl/cli-components",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {