qtsk-vue3 0.0.23 → 0.0.25

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.
@@ -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>
@@ -5,10 +5,11 @@
5
5
  drag
6
6
  accept=".xls,.xlsx,.csv"
7
7
  :name="name"
8
- :limit="1"
9
- :file-list="fileList"
8
+ :limit="limit"
9
+ :file-list="fileListRef"
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,15 @@ defineProps({
33
34
  name: {
34
35
  type: String,
35
36
  default: 'file'
36
- }
37
+ },
38
+ headers: {
39
+ type: Object,
40
+ default: () => ({})
41
+ },
42
+ limit: Number
37
43
  })
38
44
 
39
- const fileList = ref([{name: '1234.xsl (20K)'}])
45
+ const fileListRef = ref([])
40
46
  const emits = defineEmits(['successUpload'])
41
47
  const beforeUpload = (file) => {
42
48
  const isAllowedType = /\.(xls|xlsx|csv)$/.test(file.name);
@@ -55,17 +61,14 @@ const handleSuccess = (res, file, fileList) => {
55
61
  if (res.code === 200) {
56
62
  const size = (file.size / 1024).toFixed(2)
57
63
  const name = `${file.name} (${size}K)`
58
- if (fileList.value.length === 1) {
59
- fileList.value = [{
60
- name
61
- }];
62
- } else {
63
- fileList.value.push(
64
- {
65
- name
66
- }
67
- );
68
- }
64
+ console.log('fileList.value1', fileListRef.value)
65
+ const files = fileListRef.value || []
66
+ files.push(
67
+ {
68
+ name
69
+ }
70
+ );
71
+ fileListRef.value = files
69
72
  emits('successUpload', res)
70
73
  } else {
71
74
  Message.error(res.msg || res.data.msg || res.message || '上传失败')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtsk-vue3",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "vue3版组件库",
5
5
  "main": "./package/index.js",
6
6
  "scripts": {