vdesign-ui 0.2.20 → 0.3.0
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/README.md +58 -58
- package/dist/components/actionbar/index.js +8 -8
- package/dist/components/actionbar/index.vue +39 -39
- package/dist/components/actionbar/style.less +44 -44
- package/dist/components/actionbar-cell/index.js +7 -7
- package/dist/components/actionbar-cell/index.vue +42 -42
- package/dist/components/actions/index.js +6 -6
- package/dist/components/actions/index.vue +77 -77
- package/dist/components/actions/style.less +109 -109
- package/dist/components/actions-cell/index.js +6 -6
- package/dist/components/actions-cell/index.vue +94 -94
- package/dist/components/actions-cell/style.less +38 -38
- package/dist/components/activityviews/index.js +8 -8
- package/dist/components/activityviews/index.vue +192 -192
- package/dist/components/activityviews/style.less +161 -161
- package/dist/components/badge/index.js +8 -8
- package/dist/components/badge/index.vue +49 -49
- package/dist/components/badge/style.less +54 -54
- package/dist/components/button/index.js +8 -8
- package/dist/components/button/index.vue +93 -93
- package/dist/components/button/style.less +558 -558
- package/dist/components/calendar/index-element.vue +84 -84
- package/dist/components/calendar/index.js +7 -7
- package/dist/components/calendar/index.vue +53 -53
- package/dist/components/calendar/style.less +138 -138
- package/dist/components/checkbox/index.js +8 -8
- package/dist/components/checkbox/index.vue +161 -161
- package/dist/components/checkbox/style.less +288 -288
- package/dist/components/checkbox-group/index.js +7 -7
- package/dist/components/checkbox-group/index.vue +73 -73
- package/dist/components/common/state/index.vue +33 -33
- package/dist/components/common/state/style.less +47 -47
- package/dist/components/data-list/index.js +10 -10
- package/dist/components/data-list/index.vue +19 -19
- package/dist/components/data-list/style.less +623 -623
- package/dist/components/datetime-picker/index.js +7 -7
- package/dist/components/datetime-picker/index.vue +39 -39
- package/dist/components/datetime-picker/style.less +23 -23
- package/dist/components/dialog/index.js +8 -8
- package/dist/components/dialog/index.vue +164 -164
- package/dist/components/dialog/overlay-manager.js +18 -18
- package/dist/components/dialog/style.less +138 -138
- package/dist/components/divider/index.js +8 -8
- package/dist/components/divider/index.vue +54 -54
- package/dist/components/divider/style.less +92 -92
- package/dist/components/dropdown/index.js +8 -8
- package/dist/components/dropdown/index.vue +218 -218
- package/dist/components/dropdown/style.less +432 -432
- package/dist/components/empty/index.js +8 -8
- package/dist/components/empty/index.vue +138 -138
- package/dist/components/empty/style.less +60 -60
- package/dist/components/footer/index.js +6 -6
- package/dist/components/footer/index.vue +33 -33
- package/dist/components/footer/style.less +20 -20
- package/dist/components/footnav/index.js +6 -6
- package/dist/components/footnav/index.vue +93 -93
- package/dist/components/footnav/style.less +22 -22
- package/dist/components/footnav-item/index.js +6 -6
- package/dist/components/footnav-item/index.vue +50 -50
- package/dist/components/footnav-item/style.less +39 -39
- package/dist/components/form/index.js +6 -6
- package/dist/components/form/index.vue +14 -14
- package/dist/components/headnav/index.js +6 -6
- package/dist/components/headnav/index.vue +185 -185
- package/dist/components/headnav/style.less +231 -231
- package/dist/components/icon/font/iconfont.css +163 -163
- package/dist/components/icon/font/iconfont.js +5 -5
- package/dist/components/icon/index.js +9 -9
- package/dist/components/icon/index.vue +96 -96
- package/dist/components/icon/style.less +44 -44
- package/dist/components/input/calcTextareaHeight.js +162 -162
- package/dist/components/input/index.js +8 -8
- package/dist/components/input/index.vue +345 -345
- package/dist/components/input/style.less +471 -471
- package/dist/components/list/index.js +8 -8
- package/dist/components/list/index.vue +152 -152
- package/dist/components/list/style.less +213 -213
- package/dist/components/loading/index.js +6 -6
- package/dist/components/loading/index.vue +68 -68
- package/dist/components/loading/style.less +53 -53
- package/dist/components/mixins/clickoutside.js +81 -81
- package/dist/components/mixins/dom.js +41 -41
- package/dist/components/mixins/languageMixin.js +43 -43
- package/dist/components/mixins/outlineConfigPlugin.js +45 -45
- package/dist/components/mixins/router-link.js +22 -22
- package/dist/components/mixins/themeMixin.js +43 -43
- package/dist/components/noticebar/index.js +8 -8
- package/dist/components/noticebar/index.vue +258 -258
- package/dist/components/noticebar/style.less +333 -333
- package/dist/components/overlay/index.js +8 -8
- package/dist/components/overlay/index.vue +184 -184
- package/dist/components/overlay/style.less +24 -24
- package/dist/components/pagebreak/index.js +6 -6
- package/dist/components/pagebreak/index.vue +67 -67
- package/dist/components/pagebreak/style.less +41 -41
- package/dist/components/password/index.js +8 -8
- package/dist/components/password/index.vue +64 -64
- package/dist/components/popover/index.js +8 -8
- package/dist/components/popover/index.vue +100 -100
- package/dist/components/popover/style.less +346 -346
- package/dist/components/popover/vue-popover.vue +314 -314
- package/dist/components/popup/index.js +7 -7
- package/dist/components/popup/index.vue +165 -165
- package/dist/components/popup/style.less +78 -78
- package/dist/components/radio/index.js +8 -8
- package/dist/components/radio/index.vue +184 -184
- package/dist/components/radio/style.less +300 -300
- package/dist/components/radio-group/index.js +7 -7
- package/dist/components/radio-group/index.vue +62 -62
- package/dist/components/result/index.js +8 -8
- package/dist/components/result/index.vue +73 -73
- package/dist/components/result/style.less +43 -43
- package/dist/components/search/index.js +8 -8
- package/dist/components/search/index.vue +70 -70
- package/dist/components/selector/index.js +8 -8
- package/dist/components/selector/index.vue +161 -161
- package/dist/components/selector/style.less +484 -484
- package/dist/components/skeleton/index.js +6 -6
- package/dist/components/skeleton/index.vue +207 -207
- package/dist/components/skeleton/style.less +196 -196
- package/dist/components/slider/draggable.js +49 -49
- package/dist/components/slider/index.js +6 -6
- package/dist/components/slider/index.vue +167 -167
- package/dist/components/slider/style.less +99 -99
- package/dist/components/slider/utils.js +59 -59
- package/dist/components/step/index.js +7 -7
- package/dist/components/step/index.vue +48 -48
- package/dist/components/step/style.less +66 -66
- package/dist/components/step-item/index.js +7 -7
- package/dist/components/step-item/index.vue +126 -126
- package/dist/components/step-item/style.less +399 -399
- package/dist/components/stepper/index.js +8 -8
- package/dist/components/stepper/index.vue +150 -150
- package/dist/components/style/index.vue +42 -42
- package/dist/components/switch/index.js +8 -8
- package/dist/components/switch/index.vue +72 -72
- package/dist/components/switch/style.less +56 -56
- package/dist/components/tab/index.js +7 -7
- package/dist/components/tab/index.vue +97 -97
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.vue +356 -356
- package/dist/components/tabs/style.less +504 -504
- package/dist/components/tag/index.js +6 -6
- package/dist/components/tag/index.vue +64 -64
- package/dist/components/tag/style.less +210 -210
- package/dist/components/title/index.js +8 -8
- package/dist/components/title/index.vue +99 -99
- package/dist/components/title/style.less +187 -187
- package/dist/components/toast/index.js +139 -139
- package/dist/components/toast/index.vue +50 -50
- package/dist/components/toast/style.less +58 -58
- package/dist/components/transition/index.js +8 -8
- package/dist/components/transition/index.vue +13 -13
- package/dist/components/transition/style.less +208 -208
- package/dist/components/upload/index.js +6 -6
- package/dist/components/upload/index.vue +106 -106
- package/dist/components/upload/style.less +147 -147
- package/dist/components/utils/assist.js +34 -34
- package/dist/components/utils/env.js +21 -21
- package/dist/locale/ar.js +97 -97
- package/dist/locale/en.js +97 -97
- package/dist/locale/zh.js +97 -97
- package/dist/token.css +9 -9
- package/dist/vdesign-ui.common.js +83 -83
- package/dist/vdesign-ui.umd.js +83 -83
- package/package.json +113 -113
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import Vue from "vue";
|
|
2
|
-
import ToastComponent from "./index.vue";
|
|
3
|
-
import { inBrowser } from "../utils/env";
|
|
4
|
-
|
|
5
|
-
let queueResult = [];
|
|
6
|
-
let globalAllowMultiple = false;
|
|
7
|
-
let allTimer = null;
|
|
8
|
-
|
|
9
|
-
function getType(value) {
|
|
10
|
-
if (value !== value) return "NaN";
|
|
11
|
-
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function normalizeOptions(raw) {
|
|
15
|
-
let opts = {};
|
|
16
|
-
|
|
17
|
-
if (getType(raw) === 'string' || getType(raw) === 'number') {
|
|
18
|
-
opts.message = String(raw);
|
|
19
|
-
} else if (getType(raw) === 'object') {
|
|
20
|
-
opts = { ...raw };
|
|
21
|
-
} else {
|
|
22
|
-
opts.message = '';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// 默认值 & 全局/局部 allowMultiple
|
|
26
|
-
opts.duration = getType(opts.duration) === 'number' ? opts.duration : 1500;
|
|
27
|
-
opts.allowMultiple = 'allowMultiple' in opts ? !!opts.allowMultiple : globalAllowMultiple;
|
|
28
|
-
|
|
29
|
-
return opts;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
class VdToast extends Vue.extend(ToastComponent) {
|
|
33
|
-
constructor(options) {
|
|
34
|
-
super();
|
|
35
|
-
this.vm = this.$mount();
|
|
36
|
-
this.timer = null;
|
|
37
|
-
// // 局部优先,回退全局
|
|
38
|
-
// const localAllowMultiple =
|
|
39
|
-
// getType(options) === "object" && "allowMultiple" in options
|
|
40
|
-
// ? options.allowMultiple
|
|
41
|
-
// : globalAllowMultiple;
|
|
42
|
-
// this.allowMultiple = localAllowMultiple;
|
|
43
|
-
// // 判断传入的 options 类型,并进行赋值
|
|
44
|
-
// if (getType(options) === "string" || getType(options) === "number") {
|
|
45
|
-
// this.message = options;
|
|
46
|
-
// } else if (getType(options) === "object") {
|
|
47
|
-
// this.message = options.message || "";
|
|
48
|
-
// this.duration = options.duration || 1500;
|
|
49
|
-
// Object.assign(this, options);
|
|
50
|
-
// }
|
|
51
|
-
Object.assign(this, options);
|
|
52
|
-
|
|
53
|
-
this.init();
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 初始化方法
|
|
57
|
-
*/
|
|
58
|
-
init() {
|
|
59
|
-
if (inBrowser) {
|
|
60
|
-
if (!this.allowMultiple) {
|
|
61
|
-
if (allTimer) {
|
|
62
|
-
clearTimeout(allTimer);
|
|
63
|
-
}
|
|
64
|
-
queueResult.forEach((toast) => {
|
|
65
|
-
toast.clear();
|
|
66
|
-
});
|
|
67
|
-
queueResult = [];
|
|
68
|
-
queueResult.push(this);
|
|
69
|
-
allTimer = setTimeout(() => {
|
|
70
|
-
document.body.appendChild(this.vm.$el);
|
|
71
|
-
}, 50);
|
|
72
|
-
} else {
|
|
73
|
-
queueResult.push(this);
|
|
74
|
-
document.body.appendChild(this.vm.$el);
|
|
75
|
-
}
|
|
76
|
-
this.start();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
start() {
|
|
80
|
-
clearTimeout(this.timer);
|
|
81
|
-
/**
|
|
82
|
-
* 在挂载真实 DOM 树后显示过渡效果
|
|
83
|
-
*/
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
this.isShow = true;
|
|
86
|
-
if (this.duration > 0) {
|
|
87
|
-
this.end();
|
|
88
|
-
}
|
|
89
|
-
}, 0);
|
|
90
|
-
}
|
|
91
|
-
end() {
|
|
92
|
-
/**
|
|
93
|
-
* 关闭过渡效果之后移除真实 DOM 树节点
|
|
94
|
-
*/
|
|
95
|
-
this.timer = setTimeout(() => {
|
|
96
|
-
this.clear();
|
|
97
|
-
}, this.duration);
|
|
98
|
-
}
|
|
99
|
-
clear() {
|
|
100
|
-
this.isShow = false;
|
|
101
|
-
if (inBrowser && this.vm.$el) {
|
|
102
|
-
setTimeout(() => {
|
|
103
|
-
this.vm.$el.parentNode &&
|
|
104
|
-
this.vm.$el.parentNode.removeChild(this.vm.$el);
|
|
105
|
-
}, 500);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// const Toast = (options) => {
|
|
111
|
-
// const localAllowMultiple =
|
|
112
|
-
// getType(options) === "object" && "allowMultiple" in options
|
|
113
|
-
// ? options.allowMultiple
|
|
114
|
-
// : globalAllowMultiple;
|
|
115
|
-
|
|
116
|
-
// if(getType(options) === "object") {
|
|
117
|
-
// options.allowMultiple = localAllowMultiple;
|
|
118
|
-
// }
|
|
119
|
-
// return new VdToast(options);
|
|
120
|
-
// };
|
|
121
|
-
|
|
122
|
-
const Toast = (rawOptions) => {
|
|
123
|
-
const opts = normalizeOptions(rawOptions);
|
|
124
|
-
return new VdToast(opts);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
Toast.clear = () => {
|
|
129
|
-
queueResult.forEach((toast) => {
|
|
130
|
-
toast.clear();
|
|
131
|
-
});
|
|
132
|
-
queueResult = [];
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
Toast.allowMultiple = (value = true) => {
|
|
136
|
-
globalAllowMultiple = value;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default Toast;
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import ToastComponent from "./index.vue";
|
|
3
|
+
import { inBrowser } from "../utils/env";
|
|
4
|
+
|
|
5
|
+
let queueResult = [];
|
|
6
|
+
let globalAllowMultiple = false;
|
|
7
|
+
let allTimer = null;
|
|
8
|
+
|
|
9
|
+
function getType(value) {
|
|
10
|
+
if (value !== value) return "NaN";
|
|
11
|
+
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function normalizeOptions(raw) {
|
|
15
|
+
let opts = {};
|
|
16
|
+
|
|
17
|
+
if (getType(raw) === 'string' || getType(raw) === 'number') {
|
|
18
|
+
opts.message = String(raw);
|
|
19
|
+
} else if (getType(raw) === 'object') {
|
|
20
|
+
opts = { ...raw };
|
|
21
|
+
} else {
|
|
22
|
+
opts.message = '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 默认值 & 全局/局部 allowMultiple
|
|
26
|
+
opts.duration = getType(opts.duration) === 'number' ? opts.duration : 1500;
|
|
27
|
+
opts.allowMultiple = 'allowMultiple' in opts ? !!opts.allowMultiple : globalAllowMultiple;
|
|
28
|
+
|
|
29
|
+
return opts;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class VdToast extends Vue.extend(ToastComponent) {
|
|
33
|
+
constructor(options) {
|
|
34
|
+
super();
|
|
35
|
+
this.vm = this.$mount();
|
|
36
|
+
this.timer = null;
|
|
37
|
+
// // 局部优先,回退全局
|
|
38
|
+
// const localAllowMultiple =
|
|
39
|
+
// getType(options) === "object" && "allowMultiple" in options
|
|
40
|
+
// ? options.allowMultiple
|
|
41
|
+
// : globalAllowMultiple;
|
|
42
|
+
// this.allowMultiple = localAllowMultiple;
|
|
43
|
+
// // 判断传入的 options 类型,并进行赋值
|
|
44
|
+
// if (getType(options) === "string" || getType(options) === "number") {
|
|
45
|
+
// this.message = options;
|
|
46
|
+
// } else if (getType(options) === "object") {
|
|
47
|
+
// this.message = options.message || "";
|
|
48
|
+
// this.duration = options.duration || 1500;
|
|
49
|
+
// Object.assign(this, options);
|
|
50
|
+
// }
|
|
51
|
+
Object.assign(this, options);
|
|
52
|
+
|
|
53
|
+
this.init();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 初始化方法
|
|
57
|
+
*/
|
|
58
|
+
init() {
|
|
59
|
+
if (inBrowser) {
|
|
60
|
+
if (!this.allowMultiple) {
|
|
61
|
+
if (allTimer) {
|
|
62
|
+
clearTimeout(allTimer);
|
|
63
|
+
}
|
|
64
|
+
queueResult.forEach((toast) => {
|
|
65
|
+
toast.clear();
|
|
66
|
+
});
|
|
67
|
+
queueResult = [];
|
|
68
|
+
queueResult.push(this);
|
|
69
|
+
allTimer = setTimeout(() => {
|
|
70
|
+
document.body.appendChild(this.vm.$el);
|
|
71
|
+
}, 50);
|
|
72
|
+
} else {
|
|
73
|
+
queueResult.push(this);
|
|
74
|
+
document.body.appendChild(this.vm.$el);
|
|
75
|
+
}
|
|
76
|
+
this.start();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
start() {
|
|
80
|
+
clearTimeout(this.timer);
|
|
81
|
+
/**
|
|
82
|
+
* 在挂载真实 DOM 树后显示过渡效果
|
|
83
|
+
*/
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.isShow = true;
|
|
86
|
+
if (this.duration > 0) {
|
|
87
|
+
this.end();
|
|
88
|
+
}
|
|
89
|
+
}, 0);
|
|
90
|
+
}
|
|
91
|
+
end() {
|
|
92
|
+
/**
|
|
93
|
+
* 关闭过渡效果之后移除真实 DOM 树节点
|
|
94
|
+
*/
|
|
95
|
+
this.timer = setTimeout(() => {
|
|
96
|
+
this.clear();
|
|
97
|
+
}, this.duration);
|
|
98
|
+
}
|
|
99
|
+
clear() {
|
|
100
|
+
this.isShow = false;
|
|
101
|
+
if (inBrowser && this.vm.$el) {
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
this.vm.$el.parentNode &&
|
|
104
|
+
this.vm.$el.parentNode.removeChild(this.vm.$el);
|
|
105
|
+
}, 500);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// const Toast = (options) => {
|
|
111
|
+
// const localAllowMultiple =
|
|
112
|
+
// getType(options) === "object" && "allowMultiple" in options
|
|
113
|
+
// ? options.allowMultiple
|
|
114
|
+
// : globalAllowMultiple;
|
|
115
|
+
|
|
116
|
+
// if(getType(options) === "object") {
|
|
117
|
+
// options.allowMultiple = localAllowMultiple;
|
|
118
|
+
// }
|
|
119
|
+
// return new VdToast(options);
|
|
120
|
+
// };
|
|
121
|
+
|
|
122
|
+
const Toast = (rawOptions) => {
|
|
123
|
+
const opts = normalizeOptions(rawOptions);
|
|
124
|
+
return new VdToast(opts);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Toast.clear = () => {
|
|
129
|
+
queueResult.forEach((toast) => {
|
|
130
|
+
toast.clear();
|
|
131
|
+
});
|
|
132
|
+
queueResult = [];
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
Toast.allowMultiple = (value = true) => {
|
|
136
|
+
globalAllowMultiple = value;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default Toast;
|
|
@@ -1,50 +1,50 @@
|
|
|
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="[isImage ? '' : `vd-icon-${icon}`]">
|
|
6
|
-
<img class="vd-img-icon" v-if="isImage" :src="icon" />
|
|
7
|
-
</i>
|
|
8
|
-
<div>{{ message }}</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
export default {
|
|
13
|
-
name: 'vd-toast',
|
|
14
|
-
data() {
|
|
15
|
-
return {
|
|
16
|
-
message: '', // 提示语
|
|
17
|
-
isShow: false, // 是否显示
|
|
18
|
-
bgColor: '', // 背景颜色
|
|
19
|
-
icon: '', // 图标
|
|
20
|
-
duration: 1500, // 延迟时间
|
|
21
|
-
position: 'middle', // default:middle, value: top, bottom
|
|
22
|
-
allowMultiple: false
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
computed: {
|
|
26
|
-
isImage() {
|
|
27
|
-
return this.icon.includes('/');
|
|
28
|
-
},
|
|
29
|
-
customClass() {
|
|
30
|
-
var classes = [];
|
|
31
|
-
switch (this.position) {
|
|
32
|
-
case 'top':
|
|
33
|
-
classes.push('vd-toast__top');
|
|
34
|
-
break;
|
|
35
|
-
case 'bottom':
|
|
36
|
-
classes.push('vd-toast__bottom');
|
|
37
|
-
break;
|
|
38
|
-
default:
|
|
39
|
-
classes.push('vd-toast__middle');
|
|
40
|
-
}
|
|
41
|
-
classes.push(this.className);
|
|
42
|
-
|
|
43
|
-
return classes.join(' ');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
<style lang="less">
|
|
49
|
-
@import './style.less';
|
|
50
|
-
</style>
|
|
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="[isImage ? '' : `vd-icon-${icon}`]">
|
|
6
|
+
<img class="vd-img-icon" v-if="isImage" :src="icon" />
|
|
7
|
+
</i>
|
|
8
|
+
<div>{{ message }}</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'vd-toast',
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
message: '', // 提示语
|
|
17
|
+
isShow: false, // 是否显示
|
|
18
|
+
bgColor: '', // 背景颜色
|
|
19
|
+
icon: '', // 图标
|
|
20
|
+
duration: 1500, // 延迟时间
|
|
21
|
+
position: 'middle', // default:middle, value: top, bottom
|
|
22
|
+
allowMultiple: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
isImage() {
|
|
27
|
+
return this.icon.includes('/');
|
|
28
|
+
},
|
|
29
|
+
customClass() {
|
|
30
|
+
var classes = [];
|
|
31
|
+
switch (this.position) {
|
|
32
|
+
case 'top':
|
|
33
|
+
classes.push('vd-toast__top');
|
|
34
|
+
break;
|
|
35
|
+
case 'bottom':
|
|
36
|
+
classes.push('vd-toast__bottom');
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
classes.push('vd-toast__middle');
|
|
40
|
+
}
|
|
41
|
+
classes.push(this.className);
|
|
42
|
+
|
|
43
|
+
return classes.join(' ');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
<style lang="less">
|
|
49
|
+
@import './style.less';
|
|
50
|
+
</style>
|
|
@@ -1,58 +1,58 @@
|
|
|
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: 3000;
|
|
13
|
-
transition: all .3s linear;
|
|
14
|
-
opacity: 0;
|
|
15
|
-
visibility: hidden;
|
|
16
|
-
// token
|
|
17
|
-
min-width: var(--width-toast-small);
|
|
18
|
-
max-width: var(--width-toast-large);
|
|
19
|
-
padding: var(--spacing-toast-padding_x) var(--spacing-toast-padding_y);
|
|
20
|
-
background-color: var(--color-toast-bg);
|
|
21
|
-
border-radius: var(--radius-toast-content);
|
|
22
|
-
color: var(--color-toast-text);
|
|
23
|
-
font-size: var(--en-single-f-c-r-fontSize);
|
|
24
|
-
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
25
|
-
|
|
26
|
-
&.vd-toast-show {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
visibility: visible;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&-icon {
|
|
32
|
-
min-height: var(--height-toast-small);
|
|
33
|
-
|
|
34
|
-
.vd-iconfont {
|
|
35
|
-
font-size: var(--icon-toast-size);
|
|
36
|
-
margin-bottom: var(--spacing-toast-icon-margin_bottom);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&__top {
|
|
41
|
-
top: 50px;
|
|
42
|
-
left: 50%;
|
|
43
|
-
transform: translate(-50%, 0);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&__middle {
|
|
47
|
-
left: 50%;
|
|
48
|
-
top: 50%;
|
|
49
|
-
transform: translate(-50%, -50%);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__bottom {
|
|
53
|
-
top: initial;
|
|
54
|
-
bottom: 50px;
|
|
55
|
-
left: 50%;
|
|
56
|
-
transform: translate(-50%, 0);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
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: 3000;
|
|
13
|
+
transition: all .3s linear;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
// token
|
|
17
|
+
min-width: var(--width-toast-small);
|
|
18
|
+
max-width: var(--width-toast-large);
|
|
19
|
+
padding: var(--spacing-toast-padding_x) var(--spacing-toast-padding_y);
|
|
20
|
+
background-color: var(--color-toast-bg);
|
|
21
|
+
border-radius: var(--radius-toast-content);
|
|
22
|
+
color: var(--color-toast-text);
|
|
23
|
+
font-size: var(--en-single-f-c-r-fontSize);
|
|
24
|
+
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
25
|
+
|
|
26
|
+
&.vd-toast-show {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
visibility: visible;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-icon {
|
|
32
|
+
min-height: var(--height-toast-small);
|
|
33
|
+
|
|
34
|
+
.vd-iconfont {
|
|
35
|
+
font-size: var(--icon-toast-size);
|
|
36
|
+
margin-bottom: var(--spacing-toast-icon-margin_bottom);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__top {
|
|
41
|
+
top: 50px;
|
|
42
|
+
left: 50%;
|
|
43
|
+
transform: translate(-50%, 0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__middle {
|
|
47
|
+
left: 50%;
|
|
48
|
+
top: 50%;
|
|
49
|
+
transform: translate(-50%, -50%);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__bottom {
|
|
53
|
+
top: initial;
|
|
54
|
+
bottom: 50px;
|
|
55
|
+
left: 50%;
|
|
56
|
+
transform: translate(-50%, 0);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Transition from './index.vue';
|
|
2
|
-
import './style.less';
|
|
3
|
-
|
|
4
|
-
Transition.install = function (Vue) {
|
|
5
|
-
Vue.component(Transition.name, Transition);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default Transition;
|
|
1
|
+
import Transition from './index.vue';
|
|
2
|
+
import './style.less';
|
|
3
|
+
|
|
4
|
+
Transition.install = function (Vue) {
|
|
5
|
+
Vue.component(Transition.name, Transition);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default Transition;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
name: 'transition',
|
|
4
|
-
functional: true,
|
|
5
|
-
render(h, context) {
|
|
6
|
-
return h('transition', context.data, context.children)
|
|
7
|
-
},
|
|
8
|
-
}
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<style lang="less">
|
|
12
|
-
@import"./style.less";
|
|
13
|
-
</style>
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'transition',
|
|
4
|
+
functional: true,
|
|
5
|
+
render(h, context) {
|
|
6
|
+
return h('transition', context.data, context.children)
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style lang="less">
|
|
12
|
+
@import"./style.less";
|
|
13
|
+
</style>
|