qtsk-vue3 0.0.23 → 0.0.24
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/component.js
CHANGED
@@ -22,6 +22,7 @@ import Radio from './components/Radio/index.vue'
|
|
22
22
|
import Number from './components/Number/index.vue'
|
23
23
|
import Checkbox from './components/CheckBox/index.vue'
|
24
24
|
import Upload from './components/Upload/index.vue'
|
25
|
+
import Tooltip from './components/Tooltip/index.vue'
|
25
26
|
const components =
|
26
27
|
[
|
27
28
|
CommonButton,
|
@@ -47,6 +48,7 @@ const components =
|
|
47
48
|
Radio,
|
48
49
|
Number,
|
49
50
|
Checkbox,
|
50
|
-
Upload
|
51
|
+
Upload,
|
52
|
+
Tooltip
|
51
53
|
]
|
52
54
|
export default components
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<template>
|
2
|
+
<span class="normalClass">
|
3
|
+
<el-tooltip
|
4
|
+
v-bind="$attrs"
|
5
|
+
:effect="effect"
|
6
|
+
:content="content"
|
7
|
+
:placement="placement"
|
8
|
+
>
|
9
|
+
<slot/>
|
10
|
+
</el-tooltip>
|
11
|
+
</span>
|
12
|
+
</template>
|
13
|
+
|
14
|
+
<script setup>
|
15
|
+
import { ElTooltip } from 'element-plus';
|
16
|
+
defineOptions({
|
17
|
+
name: 'Tooltip',
|
18
|
+
})
|
19
|
+
defineProps({
|
20
|
+
placement: {
|
21
|
+
type: String, // 方向'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'
|
22
|
+
default: 'top'
|
23
|
+
},
|
24
|
+
content: String,
|
25
|
+
effect: {
|
26
|
+
type: String,
|
27
|
+
default: 'light', // 主题dark / light
|
28
|
+
}
|
29
|
+
})
|
30
|
+
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<style lang="less" scoped>
|
34
|
+
.normalClass {
|
35
|
+
margin: 0 0 0 10px;
|
36
|
+
display: flex;
|
37
|
+
align-items: center;
|
38
|
+
}
|
39
|
+
</style>
|
@@ -9,6 +9,7 @@
|
|
9
9
|
:file-list="fileList"
|
10
10
|
:before-upload="beforeUpload"
|
11
11
|
:on-success="handleSuccess"
|
12
|
+
:headers="headers"
|
12
13
|
:action="url">
|
13
14
|
<Icons :type="'Plus'" :size="30"></Icons>
|
14
15
|
<div class="el-upload__text">
|
@@ -33,10 +34,14 @@ defineProps({
|
|
33
34
|
name: {
|
34
35
|
type: String,
|
35
36
|
default: 'file'
|
37
|
+
},
|
38
|
+
headers: {
|
39
|
+
type: Object,
|
40
|
+
default: () => ({})
|
36
41
|
}
|
37
42
|
})
|
38
43
|
|
39
|
-
const fileList = ref([
|
44
|
+
const fileList = ref([])
|
40
45
|
const emits = defineEmits(['successUpload'])
|
41
46
|
const beforeUpload = (file) => {
|
42
47
|
const isAllowedType = /\.(xls|xlsx|csv)$/.test(file.name);
|
@@ -55,16 +60,18 @@ const handleSuccess = (res, file, fileList) => {
|
|
55
60
|
if (res.code === 200) {
|
56
61
|
const size = (file.size / 1024).toFixed(2)
|
57
62
|
const name = `${file.name} (${size}K)`
|
58
|
-
if (fileList.value
|
63
|
+
if (fileList.value?.length === 1) {
|
59
64
|
fileList.value = [{
|
60
65
|
name
|
61
66
|
}];
|
62
67
|
} else {
|
63
|
-
fileList.value
|
68
|
+
const files = fileList.value || []
|
69
|
+
files.push(
|
64
70
|
{
|
65
71
|
name
|
66
72
|
}
|
67
73
|
);
|
74
|
+
fileList.value = files
|
68
75
|
}
|
69
76
|
emits('successUpload', res)
|
70
77
|
} else {
|