qtsk-vue3 0.0.18 → 0.0.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/components/Area/index.vue +16 -15
- package/package/components/DatePicker/index.vue +1 -1
- package/package/components/FormItem/index.vue +1 -1
- package/package/components/Input/index.vue +4 -2
- package/package/components/Loading/index.js +3 -0
- package/package/components/Select/index.vue +5 -1
- package/package/index.backup.js +1 -2
- package/package/index.js +23 -22
- package/package/utils/common.js +27 -1
- package/package.json +1 -1
@@ -4,35 +4,36 @@
|
|
4
4
|
placeholder="请选择省市区"
|
5
5
|
size="default"
|
6
6
|
:options="regionData"
|
7
|
-
v-model="
|
7
|
+
v-model="modelValue"
|
8
|
+
clearable
|
9
|
+
@change="handleChange"
|
8
10
|
>
|
9
11
|
</el-cascader>
|
10
12
|
</div>
|
11
13
|
</template>
|
12
14
|
|
13
15
|
<script setup>
|
14
|
-
import { computed } from 'vue'
|
15
16
|
import { ElCascader } from 'element-plus'
|
16
17
|
import { regionData } from 'element-china-area-data'
|
18
|
+
import { treeToArray } from '../../utils/common'
|
19
|
+
const regionFlatData = treeToArray(regionData)
|
17
20
|
defineOptions({
|
18
21
|
name: 'Area',
|
19
22
|
})
|
20
23
|
const props = defineProps({
|
21
|
-
|
22
|
-
type: Array,
|
23
|
-
default: () => ([])
|
24
|
-
}
|
24
|
+
idx: Number
|
25
25
|
})
|
26
|
-
|
27
|
-
const
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
|
27
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
28
|
+
const modelValue = defineModel('modelValue')
|
29
|
+
|
30
|
+
const handleChange = (value) => {
|
31
|
+
emits('change', {index: props.idx, value})
|
32
|
+
}
|
33
|
+
defineExpose({
|
34
|
+
regionFlatData
|
35
35
|
})
|
36
|
+
|
36
37
|
</script>
|
37
38
|
|
38
39
|
<style lang="less" scoped>
|
@@ -37,9 +37,10 @@ const props = defineProps({
|
|
37
37
|
type: [String, Number],
|
38
38
|
default: ''
|
39
39
|
},
|
40
|
-
disabled: Boolean
|
40
|
+
disabled: Boolean,
|
41
|
+
idx: Number
|
41
42
|
})
|
42
|
-
const emits = defineEmits(['update:modelValue'])
|
43
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
43
44
|
const formData = defineModel('formData')
|
44
45
|
const inputValue = computed({
|
45
46
|
get () {
|
@@ -50,6 +51,7 @@ const inputValue = computed({
|
|
50
51
|
value = value.trim()
|
51
52
|
}
|
52
53
|
if (formData.value?.loc) formData.value.loc = ''
|
54
|
+
emits('change', {index: props.idx || 0, keyWord: value})
|
53
55
|
emits('update:modelValue', value)
|
54
56
|
}
|
55
57
|
})
|
@@ -5,7 +5,7 @@
|
|
5
5
|
v-bind="$attrs"
|
6
6
|
:teleported="false"
|
7
7
|
:no-data-text="'暂无数据项'"
|
8
|
-
clearable
|
8
|
+
:clearable="clearable"
|
9
9
|
>
|
10
10
|
<el-option v-for="item in options" :key="item[valueName]" :label="item[keyName]" :value="item[valueName]">
|
11
11
|
<div v-if="item.icon" style="display: flex;align-items: center;justify-content: space-between;">
|
@@ -39,6 +39,10 @@ defineProps({
|
|
39
39
|
valueName: {
|
40
40
|
type: String,
|
41
41
|
default: 'value'
|
42
|
+
},
|
43
|
+
clearable: {
|
44
|
+
type: Boolean,
|
45
|
+
default: true
|
42
46
|
}
|
43
47
|
})
|
44
48
|
const selectValue = defineModel('modelValue', { default: '', type: [Number, String, Array] })
|
package/package/index.backup.js
CHANGED
@@ -19,5 +19,4 @@ const install = makeInstaller(Components)
|
|
19
19
|
|
20
20
|
export { Message, MessageBox, install, install as default }
|
21
21
|
|
22
|
-
console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
|
23
|
-
|
22
|
+
console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
|
package/package/index.js
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
-
import Components from './component'
|
2
|
-
import { Message, MessageBox } from './components/Message'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
apps.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
import Components from './component'
|
2
|
+
import { Message, MessageBox } from './components/Message'
|
3
|
+
import { Loading } from './components/Loading'
|
4
|
+
|
5
|
+
const makeInstaller = (components = [], directives = []) => {
|
6
|
+
const apps = []
|
7
|
+
const install = (app, opts) => {
|
8
|
+
const option = opts
|
9
|
+
if (apps.includes(app)) return
|
10
|
+
apps.push(app)
|
11
|
+
components.forEach((c) => {
|
12
|
+
app.component(c.name, c)
|
13
|
+
})
|
14
|
+
app.config.globalProperties.$ELEMENT = option
|
15
|
+
}
|
16
|
+
return install
|
17
|
+
}
|
18
|
+
|
19
|
+
const install = makeInstaller(Components)
|
20
|
+
|
21
|
+
export { Message, MessageBox, Loading, install, install as default }
|
22
|
+
|
23
|
+
console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
|
package/package/utils/common.js
CHANGED
@@ -52,4 +52,30 @@ export const dateFormat = (time, format) => {
|
|
52
52
|
} else {
|
53
53
|
return ''
|
54
54
|
}
|
55
|
-
}
|
55
|
+
}
|
56
|
+
|
57
|
+
// 将树形结构数组对象转换为二维数组
|
58
|
+
export const treeToArray = (treeArray) => {
|
59
|
+
const result = []
|
60
|
+
|
61
|
+
function flatten (node, level) {
|
62
|
+
result.push({
|
63
|
+
id: node.value,
|
64
|
+
name: node.label,
|
65
|
+
level: level
|
66
|
+
})
|
67
|
+
|
68
|
+
if (node.children && node.children.length > 0) {
|
69
|
+
node.children.forEach(child => {
|
70
|
+
flatten(child, level + 1)
|
71
|
+
})
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
treeArray.forEach(node => {
|
76
|
+
flatten(node, 0)
|
77
|
+
})
|
78
|
+
|
79
|
+
return result
|
80
|
+
}
|
81
|
+
|