vdesign-ui 0.1.20 → 0.1.21
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.json +1 -1
- package/dist/components/actionbar/actionbar-cell/index.vue +0 -34
- package/dist/components/actionbar/index.js +0 -8
- package/dist/components/actionbar/index.vue +0 -39
- package/dist/components/actionbar/style.less +0 -48
- package/dist/components/actions-cell/actions/index.js +0 -7
- package/dist/components/actions-cell/actions/index.vue +0 -76
- package/dist/components/actions-cell/actions/style.less +0 -112
- package/dist/components/actions-cell/index.js +0 -7
- package/dist/components/actions-cell/index.vue +0 -94
- package/dist/components/actions-cell/style.less +0 -39
- package/dist/components/activityviews/index.js +0 -8
- package/dist/components/activityviews/index.vue +0 -140
- package/dist/components/activityviews/style.less +0 -138
- package/dist/components/badge/index.js +0 -8
- package/dist/components/badge/index.vue +0 -49
- package/dist/components/badge/style.less +0 -66
- package/dist/components/button/index.js +0 -8
- package/dist/components/button/index.vue +0 -89
- package/dist/components/button/style.less +0 -563
- package/dist/components/calendar/end.png +0 -0
- package/dist/components/calendar/index-element.vue +0 -84
- package/dist/components/calendar/index.js +0 -8
- package/dist/components/calendar/index.vue +0 -52
- package/dist/components/calendar/start.png +0 -0
- package/dist/components/calendar/style.less +0 -167
- package/dist/components/checkbox/assist.js +0 -34
- package/dist/components/checkbox/checkbox-group/index.js +0 -8
- package/dist/components/checkbox/checkbox-group/index.vue +0 -69
- package/dist/components/checkbox/index.js +0 -8
- package/dist/components/checkbox/index.vue +0 -184
- package/dist/components/checkbox/style.less +0 -291
- package/dist/components/common/state/index.vue +0 -80
- package/dist/components/data-list/index.js +0 -10
- package/dist/components/data-list/index.vue +0 -19
- package/dist/components/data-list/style.less +0 -624
- package/dist/components/datetime-picker/index.js +0 -8
- package/dist/components/datetime-picker/index.vue +0 -37
- package/dist/components/datetime-picker/style.less +0 -24
- package/dist/components/dialog/index.js +0 -8
- package/dist/components/dialog/index.vue +0 -162
- package/dist/components/dialog/overlay-manager.js +0 -18
- package/dist/components/dialog/style.less +0 -132
- package/dist/components/divider/index.js +0 -8
- package/dist/components/divider/index.vue +0 -54
- package/dist/components/divider/style.less +0 -92
- package/dist/components/dropdown/index.js +0 -8
- package/dist/components/dropdown/index.vue +0 -210
- package/dist/components/dropdown/style.less +0 -418
- package/dist/components/empty/404-dark.png +0 -0
- package/dist/components/empty/404.png +0 -0
- package/dist/components/empty/index.js +0 -8
- package/dist/components/empty/index.vue +0 -95
- package/dist/components/empty/network-dark.png +0 -0
- package/dist/components/empty/network.png +0 -0
- package/dist/components/empty/nodata-dark.png +0 -0
- package/dist/components/empty/nodata.png +0 -0
- package/dist/components/empty/style.less +0 -60
- package/dist/components/footer/index.js +0 -7
- package/dist/components/footer/index.vue +0 -29
- package/dist/components/footer/style.less +0 -22
- package/dist/components/footnav/footnav-item/index.js +0 -7
- package/dist/components/footnav/footnav-item/index.vue +0 -75
- package/dist/components/footnav/footnav-item/style.less +0 -39
- package/dist/components/footnav/index.js +0 -7
- package/dist/components/footnav/index.vue +0 -97
- package/dist/components/footnav/style.less +0 -23
- package/dist/components/form/index.js +0 -7
- package/dist/components/form/index.vue +0 -12
- package/dist/components/headnav/index.js +0 -7
- package/dist/components/headnav/index.vue +0 -163
- package/dist/components/headnav/style.less +0 -245
- package/dist/components/icon/font/iconfont.css +0 -1050
- package/dist/components/icon/font/iconfont.js +0 -2
- package/dist/components/icon/index.js +0 -9
- package/dist/components/icon/index.vue +0 -46
- package/dist/components/icon/style.less +0 -44
- package/dist/components/input/calcTextareaHeight.js +0 -266
- package/dist/components/input/index.js +0 -8
- package/dist/components/input/index.vue +0 -343
- package/dist/components/input/password/index.js +0 -8
- package/dist/components/input/password/index.vue +0 -60
- package/dist/components/input/search/index.js +0 -8
- package/dist/components/input/search/index.vue +0 -66
- package/dist/components/input/stepper/index.js +0 -8
- package/dist/components/input/stepper/index.vue +0 -136
- package/dist/components/input/style.less +0 -497
- package/dist/components/list/index.js +0 -8
- package/dist/components/list/index.vue +0 -159
- package/dist/components/list/style.less +0 -292
- package/dist/components/loading/index.js +0 -7
- package/dist/components/loading/index.vue +0 -53
- package/dist/components/loading/loading.png +0 -0
- package/dist/components/loading/refresh.png +0 -0
- package/dist/components/loading/style.less +0 -48
- package/dist/components/mixins/clickoutside.js +0 -81
- package/dist/components/mixins/dom.js +0 -41
- package/dist/components/mixins/languageMixin.js +0 -38
- package/dist/components/mixins/outlineConfigPlugin.js +0 -40
- package/dist/components/mixins/router-link.js +0 -23
- package/dist/components/mixins/themeMixin.js +0 -29
- package/dist/components/noticebar/index.js +0 -8
- package/dist/components/noticebar/index.vue +0 -247
- package/dist/components/noticebar/style.less +0 -332
- package/dist/components/overlay/index.js +0 -8
- package/dist/components/overlay/index.vue +0 -161
- package/dist/components/overlay/style.less +0 -23
- package/dist/components/pagebreak/index.js +0 -7
- package/dist/components/pagebreak/index.vue +0 -60
- package/dist/components/pagebreak/style.less +0 -43
- package/dist/components/popover/index.js +0 -8
- package/dist/components/popover/index.vue +0 -99
- package/dist/components/popover/style.less +0 -346
- package/dist/components/popover/vue-popover.vue +0 -314
- package/dist/components/radio/assist.js +0 -34
- package/dist/components/radio/index.js +0 -8
- package/dist/components/radio/index.vue +0 -159
- package/dist/components/radio/radio-group/index.vue +0 -70
- package/dist/components/radio/style.less +0 -297
- package/dist/components/result/completed-dark.png +0 -0
- package/dist/components/result/completed.png +0 -0
- package/dist/components/result/error-dark.png +0 -0
- package/dist/components/result/error.png +0 -0
- package/dist/components/result/index.js +0 -8
- package/dist/components/result/index.vue +0 -75
- package/dist/components/result/style.less +0 -42
- package/dist/components/result/wait-dark.png +0 -0
- package/dist/components/result/wait.png +0 -0
- package/dist/components/selector/index.js +0 -8
- package/dist/components/selector/index.vue +0 -124
- package/dist/components/selector/style.less +0 -474
- package/dist/components/skeleton/index.js +0 -7
- package/dist/components/skeleton/index.vue +0 -142
- package/dist/components/skeleton/style.less +0 -192
- package/dist/components/slider/draggable.js +0 -49
- package/dist/components/slider/index.js +0 -7
- package/dist/components/slider/index.vue +0 -173
- package/dist/components/slider/style.less +0 -96
- package/dist/components/slider/utils.js +0 -60
- package/dist/components/step/index.js +0 -7
- package/dist/components/step/index.vue +0 -48
- package/dist/components/step/style.less +0 -59
- package/dist/components/step-item/index.js +0 -7
- package/dist/components/step-item/index.vue +0 -117
- package/dist/components/step-item/style.less +0 -361
- package/dist/components/style/index.vue +0 -42
- package/dist/components/switch/index.js +0 -8
- package/dist/components/switch/index.vue +0 -72
- package/dist/components/switch/style.less +0 -56
- package/dist/components/tabs/index.js +0 -8
- package/dist/components/tabs/index.vue +0 -145
- package/dist/components/tabs/style.less +0 -385
- package/dist/components/tabs/tab/index.vue +0 -56
- package/dist/components/tag/index.js +0 -7
- package/dist/components/tag/index.vue +0 -50
- package/dist/components/tag/style.less +0 -211
- package/dist/components/title/index.js +0 -8
- package/dist/components/title/index.vue +0 -92
- package/dist/components/title/style.less +0 -188
- package/dist/components/toast/index.js +0 -80
- package/dist/components/toast/index.vue +0 -44
- package/dist/components/toast/style.less +0 -55
- package/dist/components/transition/index.js +0 -8
- package/dist/components/transition/index.vue +0 -13
- package/dist/components/transition/style.less +0 -208
- package/dist/components/upload/index.js +0 -7
- package/dist/components/upload/index.vue +0 -224
- package/dist/components/upload/style.less +0 -156
- package/dist/demo.html +0 -10
- package/dist/img/404-dark.775df5bb.png +0 -0
- package/dist/img/completed-dark.4183a8a8.png +0 -0
- package/dist/img/error-dark.b80857da.png +0 -0
- package/dist/img/network-dark.11a147bb.png +0 -0
- package/dist/img/nodata-dark.b0ea0e39.png +0 -0
- package/dist/img/wait-dark.6aa28731.png +0 -0
- package/dist/locale/ar.js +0 -98
- package/dist/locale/en.js +0 -98
- package/dist/locale/zh.js +0 -98
- package/dist/token.css +0 -2982
- package/dist/vdesign-ui.common.js +0 -27204
- package/dist/vdesign-ui.css +0 -1
- package/dist/vdesign-ui.umd.js +0 -27214
- package/dist/vdesign-ui.umd.min.js +0 -32
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 消息提示 -->
|
|
3
|
-
<div :class="['vd-toast', { 'vd-toast-show': isShow }, { 'vd-toast-icon': !!icon }, customClass]"
|
|
4
|
-
:style="`background:${bgColor};`">
|
|
5
|
-
<i v-if="!!icon" class="vd-iconfont" :class="`vd-icon-${icon}`"></i>
|
|
6
|
-
<div>{{ message }}</div>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
<script>
|
|
10
|
-
export default {
|
|
11
|
-
name: 'vd-toast',
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
message: '', // 提示语
|
|
15
|
-
isShow: false, // 是否显示
|
|
16
|
-
bgColor: '', // 背景颜色
|
|
17
|
-
icon: '', // 图标
|
|
18
|
-
duration: 1500, // 延迟时间
|
|
19
|
-
position: 'middle' // default:middle, value: top, bottom
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
computed: {
|
|
23
|
-
customClass() {
|
|
24
|
-
var classes = [];
|
|
25
|
-
switch (this.position) {
|
|
26
|
-
case 'top':
|
|
27
|
-
classes.push('vd-toast__top');
|
|
28
|
-
break;
|
|
29
|
-
case 'bottom':
|
|
30
|
-
classes.push('vd-toast__bottom');
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
classes.push('vd-toast__middle');
|
|
34
|
-
}
|
|
35
|
-
classes.push(this.className);
|
|
36
|
-
|
|
37
|
-
return classes.join(' ');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
<style lang="less">
|
|
43
|
-
@import './style.less';
|
|
44
|
-
</style>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
@prefix: ~"vd-toast";
|
|
2
|
-
|
|
3
|
-
.@{prefix} {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
width: max-content;
|
|
6
|
-
position: fixed;
|
|
7
|
-
top: 50%;
|
|
8
|
-
left: 50%;
|
|
9
|
-
transform: translate(-50%, -50%);
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
text-align: center;
|
|
12
|
-
z-index: 1000;
|
|
13
|
-
transition: opacity .3s linear;
|
|
14
|
-
opacity: 0;
|
|
15
|
-
// token
|
|
16
|
-
min-width: calc(var(--width-toast-small)* 1px);
|
|
17
|
-
max-width: calc(var(--width-toast-large)* 1px);
|
|
18
|
-
padding: calc(var(--spacing-toast-padding_x) * 1px) calc(var(--spacing-toast-padding_y) * 1px);
|
|
19
|
-
background-color: var(--color-toast-bg);
|
|
20
|
-
border-radius: calc(var(--radius-toast-content) * 1px);
|
|
21
|
-
color: var(--color-toast-text);
|
|
22
|
-
font-size: calc(var(--en-single-f-c-r-fontSize) * 1px);
|
|
23
|
-
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
24
|
-
|
|
25
|
-
&.vd-toast-show {
|
|
26
|
-
opacity: 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&-icon {
|
|
30
|
-
min-height: calc(var(--height-toast-small) * 1px);
|
|
31
|
-
|
|
32
|
-
.vd-iconfont {
|
|
33
|
-
font-size: calc(var(--icon-toast-size) * 1px);
|
|
34
|
-
margin-bottom: calc(var(--spacing-toast-icon-margin_bottom) * 1px);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&__top {
|
|
39
|
-
top: 50px;
|
|
40
|
-
left: 50%;
|
|
41
|
-
transform: translate(-50%, 0);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&__middle {
|
|
45
|
-
left: 50%;
|
|
46
|
-
top: 50%;
|
|
47
|
-
transform: translate(-50%, -50%);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&__bottom {
|
|
51
|
-
bottom: 50px;
|
|
52
|
-
left: 50%;
|
|
53
|
-
transform: translate(-50%, 0);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
.bounce-enter-active {
|
|
2
|
-
animation: bounce-in 300ms linear;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.bounce-leave-active {
|
|
6
|
-
animation: zoom-out 250ms linear;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.zoom-enter,
|
|
10
|
-
.zoom-leave-to {
|
|
11
|
-
opacity: 0.01;
|
|
12
|
-
transform: scale(0.75);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.zoom-enter-active {
|
|
16
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.zoom-leave-active {
|
|
20
|
-
transition: all 250ms linear;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.punch-enter,
|
|
24
|
-
.punch-leave-to {
|
|
25
|
-
opacity: 0.01;
|
|
26
|
-
transform: scale(1.35);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.punch-enter-active {
|
|
30
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.punch-leave-active {
|
|
34
|
-
transition: all 250ms linear;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.slide-up-enter,
|
|
38
|
-
.slide-up-leave-to {
|
|
39
|
-
transform: translate3d(0, 100%, 0);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.slide-up-enter-active {
|
|
43
|
-
transition: transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.slide-up-leave-active {
|
|
47
|
-
transition: transform 250ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.slide-right-enter,
|
|
51
|
-
.slide-right-leave-to {
|
|
52
|
-
transform: translate3d(-100%, 0, 0);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.slide-right-enter-active {
|
|
56
|
-
transition: transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.slide-right-leave-active {
|
|
60
|
-
transition: transform 250ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.slide-left-enter,
|
|
64
|
-
.slide-left-leave-to {
|
|
65
|
-
transform: translate3d(100%, 0, 0);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.slide-left-enter-active {
|
|
69
|
-
transition: transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.slide-left-leave-active {
|
|
73
|
-
transition: transform 250ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.slide-down-enter,
|
|
77
|
-
.slide-down-leave-to {
|
|
78
|
-
transform: translate3d(0, -100%, 0);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.slide-down-enter-active {
|
|
82
|
-
transition: transform 300ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.slide-down-leave-active {
|
|
86
|
-
transition: transform 250ms cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.fade-enter,
|
|
90
|
-
.fade-leave-to {
|
|
91
|
-
opacity: 0.01;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.fade-enter-active {
|
|
95
|
-
transition: opacity 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.fade-leave-active {
|
|
99
|
-
transition: opacity 250ms linear;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.fade-up-enter,
|
|
103
|
-
.fade-up-leave-to {
|
|
104
|
-
opacity: 0.01;
|
|
105
|
-
transform: translate3d(0, 20%, 0);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.fade-up-enter-active {
|
|
109
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.fade-up-leave-active {
|
|
113
|
-
transition: all 250ms linear;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.fade-down-enter,
|
|
117
|
-
.fade-down-leave-to {
|
|
118
|
-
opacity: 0.01;
|
|
119
|
-
transform: translate3d(0, -20%, 0);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.fade-down-enter-active {
|
|
123
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.fade-down-leave-active {
|
|
127
|
-
transition: all 250ms linear;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.fade-right-enter,
|
|
131
|
-
.fade-right-leave-to {
|
|
132
|
-
opacity: 0.01;
|
|
133
|
-
transform: translate3d(-20%, 0, 0);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.fade-right-enter-active {
|
|
137
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.fade-right-leave-active {
|
|
141
|
-
transition: all 250ms linear;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.fade-left-enter,
|
|
145
|
-
.fade-left-leave-to {
|
|
146
|
-
opacity: 0.01;
|
|
147
|
-
transform: translate3d(20%, 0, 0);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.fade-left-enter-active {
|
|
151
|
-
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.fade-left-leave-active {
|
|
155
|
-
transition: all 250ms linear;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.fly-enter-active {
|
|
159
|
-
animation: fly-in 600ms;
|
|
160
|
-
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.fly-leave-active {
|
|
164
|
-
animation: zoom-out 250ms;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
@keyframes fly-in {
|
|
169
|
-
0% {
|
|
170
|
-
opacity: 0.5;
|
|
171
|
-
transform: scale(0.5) translate3d(0, 50px, 0);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
45% {
|
|
175
|
-
opacity: 1;
|
|
176
|
-
transform: scale(1.05) translate3d(0, -50px, 0);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
100% {
|
|
180
|
-
transform: scale(1) translate3d(0, 0, 0);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
@keyframes bounce-in {
|
|
186
|
-
0% {
|
|
187
|
-
transform: scale(0.5);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
45% {
|
|
191
|
-
transform: scale(1.05);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
80% {
|
|
195
|
-
transform: scale(0.95);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
100% {
|
|
199
|
-
transform: scale(1);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
@keyframes zoom-out {
|
|
204
|
-
to {
|
|
205
|
-
opacity: 0.01;
|
|
206
|
-
transform: scale(0.75);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vd-upload" :class="{ 'vd-upload--block': (block && listData.length === 0) }">
|
|
3
|
-
<div class="vd-upload__wrapper">
|
|
4
|
-
<div class="vd-upload__uploader" :class="{ 'vd-upload__uploader--text': text }">
|
|
5
|
-
<vd-icon name="icon_btn_photo" class="vd-upload__icon"></vd-icon>
|
|
6
|
-
<p class="vd-upload__text" v-if="text">{{ text }}</p>
|
|
7
|
-
<input type="file" class="vd-upload__input" accept="image/*,.pdf" :multiple="multiple" @change="onChange"
|
|
8
|
-
:disabled="disabled">
|
|
9
|
-
</div>
|
|
10
|
-
<div class="vd-upload__preview" v-for="item in listData" :key="item.id" :class="fileCls(item.type)">
|
|
11
|
-
<div class="vd-upload__preview-img" v-if="item.type.startsWith('image')" @click="onPreview(item)">
|
|
12
|
-
<img :src="item.url" />
|
|
13
|
-
</div>
|
|
14
|
-
<div class="vd-upload__preview-word" v-if="item.type === 'application/pdf'">PDF</div>
|
|
15
|
-
<div class="vd-upload__preview-delete" @click="onDelete($event, item)" v-if="deletable">
|
|
16
|
-
<vd-icon name="icon_btn_close" class="vd-upload__preview-delete-icon"></vd-icon>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="vd-image-preview" v-if="isPreview" @click="closePreview">
|
|
21
|
-
<div class="vd-image-preview__item" v-for="item in listData" :key="item.id" v-show="curNum === item.id"><img
|
|
22
|
-
:src="item.url" /></div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
const prefixCls = 'vd-upload';
|
|
29
|
-
export default {
|
|
30
|
-
name: 'vd-upload',
|
|
31
|
-
model: {
|
|
32
|
-
prop: 'fileList'
|
|
33
|
-
},
|
|
34
|
-
props: {
|
|
35
|
-
uploaded: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false
|
|
38
|
-
},
|
|
39
|
-
preview: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
block: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false
|
|
46
|
-
},
|
|
47
|
-
text: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: ''
|
|
50
|
-
},
|
|
51
|
-
fileList: {
|
|
52
|
-
type: Array,
|
|
53
|
-
default: () => []
|
|
54
|
-
},
|
|
55
|
-
deletable: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: true
|
|
58
|
-
},
|
|
59
|
-
disabled: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* 文件读取前钩子函数
|
|
65
|
-
*/
|
|
66
|
-
beforeRead: {
|
|
67
|
-
type: Function,
|
|
68
|
-
default: () => () => true
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* 文件读取完钩子函数
|
|
72
|
-
*/
|
|
73
|
-
afterRead: {
|
|
74
|
-
type: Function,
|
|
75
|
-
default: () => () => true
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* 文件删除前钩子函数
|
|
79
|
-
*/
|
|
80
|
-
beforeDelete: {
|
|
81
|
-
type: Function,
|
|
82
|
-
default: () => () => true
|
|
83
|
-
},
|
|
84
|
-
maxCount: {
|
|
85
|
-
type: Number,
|
|
86
|
-
default: 1000
|
|
87
|
-
},
|
|
88
|
-
maxSize: {
|
|
89
|
-
type: Number,
|
|
90
|
-
default: 6 * 1024 * 1024
|
|
91
|
-
},
|
|
92
|
-
multiple: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
default: false
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
data() {
|
|
98
|
-
return {
|
|
99
|
-
listData: this.fileList,
|
|
100
|
-
curNum: 1,
|
|
101
|
-
isPreview: false
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
watch: {
|
|
105
|
-
/**
|
|
106
|
-
* 监听列表数据
|
|
107
|
-
*/
|
|
108
|
-
fileList: {
|
|
109
|
-
handler(value) {
|
|
110
|
-
this.listData = value
|
|
111
|
-
},
|
|
112
|
-
deep: true
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
methods: {
|
|
116
|
-
fileCls(file) {
|
|
117
|
-
if (file === 'application/pdf') {
|
|
118
|
-
return [`${prefixCls}__preview--pdf`];
|
|
119
|
-
} else {
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
onDelete(e, item) {
|
|
124
|
-
e.stopPropagation()
|
|
125
|
-
const { disabled, beforeDelete, listData } = this
|
|
126
|
-
/**
|
|
127
|
-
* 判断是否允许删除文件
|
|
128
|
-
*/
|
|
129
|
-
if (!disabled && beforeDelete(item) !== false) {
|
|
130
|
-
/**
|
|
131
|
-
* 索引
|
|
132
|
-
*/
|
|
133
|
-
let i = 0
|
|
134
|
-
/**
|
|
135
|
-
* 循环遍历数组定位下标位置
|
|
136
|
-
*/
|
|
137
|
-
for (; i < listData.length; i++) {
|
|
138
|
-
/**
|
|
139
|
-
* 判断 id 是否相等
|
|
140
|
-
*/
|
|
141
|
-
if (listData[i].id === item.id) break
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 删除
|
|
145
|
-
*/
|
|
146
|
-
listData.splice(i, 1)
|
|
147
|
-
this.$emit('input', listData)
|
|
148
|
-
this.$emit('on-change', listData)
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
onChange(e) {
|
|
152
|
-
const { beforeRead, afterRead, maxSize, maxCount, listData } = this
|
|
153
|
-
/**
|
|
154
|
-
* 获取不超过 maxCount 文件
|
|
155
|
-
*/
|
|
156
|
-
const files = Object.values(e.target.files).slice(0, maxCount)
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* 判断是否允许读取文件
|
|
160
|
-
*/
|
|
161
|
-
if (beforeRead(files) !== false) {
|
|
162
|
-
/**
|
|
163
|
-
* 循环遍历添加数据
|
|
164
|
-
*/
|
|
165
|
-
const arr = []
|
|
166
|
-
files.forEach(elem => {
|
|
167
|
-
/**
|
|
168
|
-
* 判断大小是否小于或等于 maxSize
|
|
169
|
-
*/
|
|
170
|
-
if (elem.size <= maxSize) {
|
|
171
|
-
/**
|
|
172
|
-
* 数组长度
|
|
173
|
-
*/
|
|
174
|
-
const len = listData.length
|
|
175
|
-
/**
|
|
176
|
-
* 获取 id
|
|
177
|
-
*/
|
|
178
|
-
const id = len === 0 ? 1 : listData[len - 1].id + 1
|
|
179
|
-
/**
|
|
180
|
-
* 创建 blob 预览图片地址
|
|
181
|
-
*/
|
|
182
|
-
const url = window.URL.createObjectURL(elem)
|
|
183
|
-
|
|
184
|
-
const type = e.target.files[0].type;
|
|
185
|
-
/**
|
|
186
|
-
* 添加进数组
|
|
187
|
-
*/
|
|
188
|
-
listData.push({ id, url, type })
|
|
189
|
-
arr.push(elem)
|
|
190
|
-
}
|
|
191
|
-
})
|
|
192
|
-
/**
|
|
193
|
-
* 符合规则的图片数组
|
|
194
|
-
*/
|
|
195
|
-
if (arr.length > 0) {
|
|
196
|
-
afterRead(arr)
|
|
197
|
-
this.$emit('change', listData)
|
|
198
|
-
this.$emit('num-changed', this.curNum);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
onPreview({ id }) {
|
|
203
|
-
const { disabled, preview } = this
|
|
204
|
-
/**
|
|
205
|
-
* 判断是否允许预览
|
|
206
|
-
*/
|
|
207
|
-
if (!disabled && preview) {
|
|
208
|
-
this.curNum = id
|
|
209
|
-
/**
|
|
210
|
-
* 打开图片预览
|
|
211
|
-
*/
|
|
212
|
-
this.isPreview = true
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
closePreview() {
|
|
216
|
-
this.isPreview = false
|
|
217
|
-
},
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
</script>
|
|
221
|
-
|
|
222
|
-
<style lang="less">
|
|
223
|
-
@import './style.less';
|
|
224
|
-
</style>
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
@upload-prefix-cls: vd-upload;
|
|
3
|
-
|
|
4
|
-
.@{upload-prefix-cls}{
|
|
5
|
-
position: relative;
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
width: 100%;
|
|
8
|
-
overflow-x: auto;
|
|
9
|
-
|
|
10
|
-
&--block{
|
|
11
|
-
display: flex;
|
|
12
|
-
width: 100%;
|
|
13
|
-
.@{upload-prefix-cls}{
|
|
14
|
-
&__wrapper{
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
&__uploader{
|
|
18
|
-
width: 100%;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&__wrapper{
|
|
25
|
-
display: flex;
|
|
26
|
-
gap: 12px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&__uploader{
|
|
30
|
-
position: relative;
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
align-items: center;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
height: calc(var(--height-upload-bg) * 1px);
|
|
36
|
-
min-width: calc(var(--width-upload-small) * 1px);
|
|
37
|
-
background-color: var(--color-upload-bg);
|
|
38
|
-
border-radius: calc( var(--radius-upload-content) * 1px);
|
|
39
|
-
|
|
40
|
-
&--text{
|
|
41
|
-
padding-block-start: calc(var(--spacing-upload-padding_top) * 1px);
|
|
42
|
-
padding-block-end: calc(var(--spacing-upload-padding_bottom) * 1px);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&__preview{
|
|
48
|
-
position: relative;
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: center;
|
|
52
|
-
width: calc(var(--width-upload-small) * 1px);
|
|
53
|
-
border-radius: calc( var(--radius-upload-content) * 1px);
|
|
54
|
-
|
|
55
|
-
&--pdf{
|
|
56
|
-
background-color: var(--color-upload-pdf-bg);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&-delete{
|
|
60
|
-
position: absolute;
|
|
61
|
-
top: 0;
|
|
62
|
-
right: 0;
|
|
63
|
-
width: 24px;
|
|
64
|
-
height: 24px;
|
|
65
|
-
display: flex;
|
|
66
|
-
align-items: center;
|
|
67
|
-
justify-content: center;
|
|
68
|
-
border-radius: 0 calc(var(--radius-upload-content) * 1px);
|
|
69
|
-
background-color: var(--color-upload-close_bg);
|
|
70
|
-
&-icon{
|
|
71
|
-
font-size: calc(var(--icon-upload-close) * 1px);
|
|
72
|
-
color: #ffffff;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
&-word{
|
|
76
|
-
color: var(--color-upload-pdf-text);
|
|
77
|
-
font-size: calc(var(--en-single-f-f-b-fontSize) * 1px);
|
|
78
|
-
font-weight: var(--en-single-f-f-b-fontWeight);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&-img{
|
|
82
|
-
|
|
83
|
-
img{
|
|
84
|
-
object-fit: cover;
|
|
85
|
-
width: calc(var(--height-upload-bg) * 1px);
|
|
86
|
-
height: calc(var(--height-upload-bg) * 1px);
|
|
87
|
-
border-radius: calc( var(--radius-upload-content) * 1px);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
&__icon{
|
|
95
|
-
font-size: calc(var(--icon-upload-size) * 1px);
|
|
96
|
-
color: var(--color-upload-icon);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&__text{
|
|
100
|
-
margin-block-start: calc(var(--spacing-upload-text-margin_top) * 1px);
|
|
101
|
-
color: var(--color-upload-text);
|
|
102
|
-
font-size: calc(var(--en-single-f-c-r-fontSize) * 1px);
|
|
103
|
-
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&__input{
|
|
107
|
-
position: absolute;
|
|
108
|
-
top: 0;
|
|
109
|
-
left: 0;
|
|
110
|
-
width: 100%;
|
|
111
|
-
height: 100%;
|
|
112
|
-
overflow: hidden;
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
opacity: 0;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.vd-image-preview{
|
|
119
|
-
display: flex;
|
|
120
|
-
flex-direction: column;
|
|
121
|
-
position: fixed;
|
|
122
|
-
top: 0;
|
|
123
|
-
left: 0;
|
|
124
|
-
z-index: 2001;
|
|
125
|
-
width: 100%;
|
|
126
|
-
height: 100%;
|
|
127
|
-
background-color: var(--color-dialog-mask_bg);
|
|
128
|
-
background: rgba(0,0,0,.8);
|
|
129
|
-
|
|
130
|
-
&__item{
|
|
131
|
-
flex-grow: 1;
|
|
132
|
-
position: relative;
|
|
133
|
-
display: flex;
|
|
134
|
-
justify-content: center;
|
|
135
|
-
align-items: center;
|
|
136
|
-
img{
|
|
137
|
-
display: block;
|
|
138
|
-
object-fit: contain;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
[lang='ar'] {
|
|
146
|
-
.@{upload-prefix-cls}{
|
|
147
|
-
&__preview{
|
|
148
|
-
&-delete{
|
|
149
|
-
left: 0;
|
|
150
|
-
right: auto;
|
|
151
|
-
border-radius: calc(var(--radius-upload-content) * 1px) 0;
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|