vdesign-ui 0.2.12 → 0.2.14
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 +78 -78
- 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 +38 -38
- package/dist/components/actions/index.js +6 -6
- package/dist/components/actions/index.vue +77 -76
- 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 +151 -151
- 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 +52 -52
- 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 +69 -69
- 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 +37 -37
- 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 +12 -12
- 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 +470 -470
- 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 +41 -41
- 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 +328 -328
- package/dist/components/overlay/index.js +8 -8
- package/dist/components/overlay/index.vue +184 -184
- package/dist/components/overlay/style.less +23 -23
- 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 +60 -60
- 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 +243 -243
- package/dist/components/radio/index.js +8 -8
- package/dist/components/radio/index.vue +184 -184
- package/dist/components/radio/style.less +293 -293
- package/dist/components/radio-group/index.js +6 -6
- package/dist/components/radio-group/index.vue +58 -58
- 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 +66 -66
- 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 -58
- 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 -362
- package/dist/components/stepper/index.js +8 -8
- package/dist/components/stepper/index.vue +146 -146
- 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 +94 -94
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.vue +292 -281
- package/dist/components/tabs/style.less +408 -408
- 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 +97 -97
- package/dist/components/toast/index.vue +49 -49
- package/dist/components/toast/style.less +57 -57
- 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 +23 -17
- package/dist/vdesign-ui.common.js +141 -129
- package/dist/vdesign-ui.css +1 -1
- package/dist/vdesign-ui.umd.js +141 -129
- package/dist/vdesign-ui.umd.min.js +2 -2
- package/package.json +113 -113
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
.vd-loading {
|
|
2
|
-
position: fixed;
|
|
3
|
-
left: 50%;
|
|
4
|
-
top: 50%;
|
|
5
|
-
transform: translate(-50%, -50%);
|
|
6
|
-
margin-block-start: -16px;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
width: fit-content;
|
|
12
|
-
min-height: var(--height-loading-small);
|
|
13
|
-
min-width: var(--width-loading-small);
|
|
14
|
-
max-width: var(--width-loading-large);
|
|
15
|
-
background-color: var(--color-loading-bg);
|
|
16
|
-
border-radius: var(--radius-loading-size);
|
|
17
|
-
padding: var(--spacing-loading-padding_x) var(--spacing-loading-padding_y);
|
|
18
|
-
|
|
19
|
-
&__text {
|
|
20
|
-
margin-block-start: var(--spacing-loading-icon-margin_bottom);
|
|
21
|
-
font-size: var(--en-single-f-c-r-fontSize);
|
|
22
|
-
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
23
|
-
color: var(--color-loading-text);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
img {
|
|
27
|
-
margin: 0 auto;
|
|
28
|
-
width: var(--icon-loading-size);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.vd-refresh {
|
|
33
|
-
position: absolute;
|
|
34
|
-
left: 50%;
|
|
35
|
-
transform: translateX(-50%);
|
|
36
|
-
|
|
37
|
-
&--large {
|
|
38
|
-
width: var(--icon-loading-refres_large);
|
|
39
|
-
|
|
40
|
-
img {
|
|
41
|
-
border: 0;
|
|
42
|
-
max-width: 100%;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&--small {
|
|
47
|
-
width: var(--icon-loading-refres_small);
|
|
48
|
-
|
|
49
|
-
img {
|
|
50
|
-
border: 0;
|
|
51
|
-
max-width: 100%;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
.vd-loading {
|
|
2
|
+
position: fixed;
|
|
3
|
+
left: 50%;
|
|
4
|
+
top: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
margin-block-start: -16px;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
width: fit-content;
|
|
12
|
+
min-height: var(--height-loading-small);
|
|
13
|
+
min-width: var(--width-loading-small);
|
|
14
|
+
max-width: var(--width-loading-large);
|
|
15
|
+
background-color: var(--color-loading-bg);
|
|
16
|
+
border-radius: var(--radius-loading-size);
|
|
17
|
+
padding: var(--spacing-loading-padding_x) var(--spacing-loading-padding_y);
|
|
18
|
+
|
|
19
|
+
&__text {
|
|
20
|
+
margin-block-start: var(--spacing-loading-icon-margin_bottom);
|
|
21
|
+
font-size: var(--en-single-f-c-r-fontSize);
|
|
22
|
+
font-weight: var(--en-single-f-c-r-fontWeight);
|
|
23
|
+
color: var(--color-loading-text);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
img {
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
width: var(--icon-loading-size);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.vd-refresh {
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: 50%;
|
|
35
|
+
transform: translateX(-50%);
|
|
36
|
+
|
|
37
|
+
&--large {
|
|
38
|
+
width: var(--icon-loading-refres_large);
|
|
39
|
+
|
|
40
|
+
img {
|
|
41
|
+
border: 0;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--small {
|
|
47
|
+
width: var(--icon-loading-refres_small);
|
|
48
|
+
|
|
49
|
+
img {
|
|
50
|
+
border: 0;
|
|
51
|
+
max-width: 100%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
import { on } from './dom';
|
|
3
|
-
// 定义一个空数组 nodeList,用于存储绑定了该指令的元素。
|
|
4
|
-
const nodeList = [];
|
|
5
|
-
//定义一个常量 ctx,用于标识特殊属性名。
|
|
6
|
-
const ctx = '@@clickoutsideContext';
|
|
7
|
-
// 定义一个变量 startClick,用于存储点击开始时的事件对象。
|
|
8
|
-
let startClick;
|
|
9
|
-
// 定义一个变量 seed,用作节点标识的种子。
|
|
10
|
-
let seed = 0;
|
|
11
|
-
// 在文档上添加一个 mousedown 事件监听器,用于记录点击开始时的事件对象。
|
|
12
|
-
!Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e));
|
|
13
|
-
// 添加一个 mouseup 事件监听器。当鼠标放开时,
|
|
14
|
-
!Vue.prototype.$isServer && on(document, 'mouseup', e => {
|
|
15
|
-
// 遍历 nodeList 数组中的每个元素,并执行它们的 documentHandler 函数。
|
|
16
|
-
nodeList.forEach(node => node[ctx].documentHandler(e, startClick));
|
|
17
|
-
});
|
|
18
|
-
// 创建一个处理文档点击事件的函数。
|
|
19
|
-
// 该函数返回一个闭包函数,用于检查点击事件是否发生在绑定的元素外部,并执行相应的回调函数。
|
|
20
|
-
function createDocumentHandler(el, binding, vnode) {
|
|
21
|
-
return function (mouseup = {}, mousedown = {}) {
|
|
22
|
-
if (!vnode ||
|
|
23
|
-
!vnode.context ||
|
|
24
|
-
!mouseup.target ||
|
|
25
|
-
!mousedown.target ||
|
|
26
|
-
el.contains(mouseup.target) ||
|
|
27
|
-
el.contains(mousedown.target) ||
|
|
28
|
-
el === mouseup.target ||
|
|
29
|
-
(vnode.context.popperElm &&
|
|
30
|
-
(vnode.context.popperElm.contains(mouseup.target) ||
|
|
31
|
-
vnode.context.popperElm.contains(mousedown.target)))) return;
|
|
32
|
-
|
|
33
|
-
if (binding.expression &&
|
|
34
|
-
el[ctx].methodName &&
|
|
35
|
-
vnode.context[el[ctx].methodName]) {
|
|
36
|
-
vnode.context[el[ctx].methodName](mouseup.target);
|
|
37
|
-
} else {
|
|
38
|
-
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* v-clickoutside
|
|
45
|
-
* @desc 点击元素外面才会触发的事件
|
|
46
|
-
* @example
|
|
47
|
-
* ```vue
|
|
48
|
-
* <div v-element-clickoutside="handleClose">
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export default {
|
|
52
|
-
// 将元素添加到 nodeList 数组中,并为该元素添加一个包含事件处理函数的特殊属性。
|
|
53
|
-
bind(el, binding, vnode) {
|
|
54
|
-
nodeList.push(el);
|
|
55
|
-
const id = seed++;
|
|
56
|
-
el[ctx] = {
|
|
57
|
-
id,
|
|
58
|
-
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
59
|
-
methodName: binding.expression,
|
|
60
|
-
bindingFn: binding.value
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
// 当指令所在组件的 VNode 更新时调用,更新元素的事件处理函数和绑定方法。
|
|
64
|
-
update(el, binding, vnode) {
|
|
65
|
-
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
66
|
-
el[ctx].methodName = binding.expression;
|
|
67
|
-
el[ctx].bindingFn = binding.value;
|
|
68
|
-
},
|
|
69
|
-
// 从 nodeList 中移除对应的元素,并删除特殊属性。
|
|
70
|
-
unbind(el) {
|
|
71
|
-
let len = nodeList.length;
|
|
72
|
-
|
|
73
|
-
for (let i = 0; i < len; i++) {
|
|
74
|
-
if (nodeList[i][ctx].id === el[ctx].id) {
|
|
75
|
-
nodeList.splice(i, 1);
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
delete el[ctx];
|
|
80
|
-
}
|
|
81
|
-
};
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import { on } from './dom';
|
|
3
|
+
// 定义一个空数组 nodeList,用于存储绑定了该指令的元素。
|
|
4
|
+
const nodeList = [];
|
|
5
|
+
//定义一个常量 ctx,用于标识特殊属性名。
|
|
6
|
+
const ctx = '@@clickoutsideContext';
|
|
7
|
+
// 定义一个变量 startClick,用于存储点击开始时的事件对象。
|
|
8
|
+
let startClick;
|
|
9
|
+
// 定义一个变量 seed,用作节点标识的种子。
|
|
10
|
+
let seed = 0;
|
|
11
|
+
// 在文档上添加一个 mousedown 事件监听器,用于记录点击开始时的事件对象。
|
|
12
|
+
!Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e));
|
|
13
|
+
// 添加一个 mouseup 事件监听器。当鼠标放开时,
|
|
14
|
+
!Vue.prototype.$isServer && on(document, 'mouseup', e => {
|
|
15
|
+
// 遍历 nodeList 数组中的每个元素,并执行它们的 documentHandler 函数。
|
|
16
|
+
nodeList.forEach(node => node[ctx].documentHandler(e, startClick));
|
|
17
|
+
});
|
|
18
|
+
// 创建一个处理文档点击事件的函数。
|
|
19
|
+
// 该函数返回一个闭包函数,用于检查点击事件是否发生在绑定的元素外部,并执行相应的回调函数。
|
|
20
|
+
function createDocumentHandler(el, binding, vnode) {
|
|
21
|
+
return function (mouseup = {}, mousedown = {}) {
|
|
22
|
+
if (!vnode ||
|
|
23
|
+
!vnode.context ||
|
|
24
|
+
!mouseup.target ||
|
|
25
|
+
!mousedown.target ||
|
|
26
|
+
el.contains(mouseup.target) ||
|
|
27
|
+
el.contains(mousedown.target) ||
|
|
28
|
+
el === mouseup.target ||
|
|
29
|
+
(vnode.context.popperElm &&
|
|
30
|
+
(vnode.context.popperElm.contains(mouseup.target) ||
|
|
31
|
+
vnode.context.popperElm.contains(mousedown.target)))) return;
|
|
32
|
+
|
|
33
|
+
if (binding.expression &&
|
|
34
|
+
el[ctx].methodName &&
|
|
35
|
+
vnode.context[el[ctx].methodName]) {
|
|
36
|
+
vnode.context[el[ctx].methodName](mouseup.target);
|
|
37
|
+
} else {
|
|
38
|
+
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* v-clickoutside
|
|
45
|
+
* @desc 点击元素外面才会触发的事件
|
|
46
|
+
* @example
|
|
47
|
+
* ```vue
|
|
48
|
+
* <div v-element-clickoutside="handleClose">
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export default {
|
|
52
|
+
// 将元素添加到 nodeList 数组中,并为该元素添加一个包含事件处理函数的特殊属性。
|
|
53
|
+
bind(el, binding, vnode) {
|
|
54
|
+
nodeList.push(el);
|
|
55
|
+
const id = seed++;
|
|
56
|
+
el[ctx] = {
|
|
57
|
+
id,
|
|
58
|
+
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
59
|
+
methodName: binding.expression,
|
|
60
|
+
bindingFn: binding.value
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
// 当指令所在组件的 VNode 更新时调用,更新元素的事件处理函数和绑定方法。
|
|
64
|
+
update(el, binding, vnode) {
|
|
65
|
+
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
66
|
+
el[ctx].methodName = binding.expression;
|
|
67
|
+
el[ctx].bindingFn = binding.value;
|
|
68
|
+
},
|
|
69
|
+
// 从 nodeList 中移除对应的元素,并删除特殊属性。
|
|
70
|
+
unbind(el) {
|
|
71
|
+
let len = nodeList.length;
|
|
72
|
+
|
|
73
|
+
for (let i = 0; i < len; i++) {
|
|
74
|
+
if (nodeList[i][ctx].id === el[ctx].id) {
|
|
75
|
+
nodeList.splice(i, 1);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
delete el[ctx];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/* istanbul ignore next */
|
|
2
|
-
|
|
3
|
-
import Vue from 'vue';
|
|
4
|
-
|
|
5
|
-
const isServer = Vue.prototype.$isServer;
|
|
6
|
-
/* istanbul ignore next */
|
|
7
|
-
export const on = (function () {
|
|
8
|
-
// 添加事件监听器
|
|
9
|
-
if (!isServer && document.addEventListener) {
|
|
10
|
-
return function (element, event, handler) {
|
|
11
|
-
if (element && event && handler) {
|
|
12
|
-
element.addEventListener(event, handler, false);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
} else {
|
|
16
|
-
// IE8 及其以下版本没有 addEventListener 方法
|
|
17
|
-
return function (element, event, handler) {
|
|
18
|
-
if (element && event && handler) {
|
|
19
|
-
element.attachEvent('on' + event, handler);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
})();
|
|
24
|
-
|
|
25
|
-
/* istanbul ignore next */
|
|
26
|
-
export const off = (function () {
|
|
27
|
-
// 移除事件监听器
|
|
28
|
-
if (!isServer && document.removeEventListener) {
|
|
29
|
-
return function (element, event, handler) {
|
|
30
|
-
if (element && event) {
|
|
31
|
-
element.removeEventListener(event, handler, false);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
} else {
|
|
35
|
-
return function (element, event, handler) {
|
|
36
|
-
if (element && event) {
|
|
37
|
-
element.detachEvent('on' + event, handler);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
1
|
+
/* istanbul ignore next */
|
|
2
|
+
|
|
3
|
+
import Vue from 'vue';
|
|
4
|
+
|
|
5
|
+
const isServer = Vue.prototype.$isServer;
|
|
6
|
+
/* istanbul ignore next */
|
|
7
|
+
export const on = (function () {
|
|
8
|
+
// 添加事件监听器
|
|
9
|
+
if (!isServer && document.addEventListener) {
|
|
10
|
+
return function (element, event, handler) {
|
|
11
|
+
if (element && event && handler) {
|
|
12
|
+
element.addEventListener(event, handler, false);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
// IE8 及其以下版本没有 addEventListener 方法
|
|
17
|
+
return function (element, event, handler) {
|
|
18
|
+
if (element && event && handler) {
|
|
19
|
+
element.attachEvent('on' + event, handler);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
})();
|
|
24
|
+
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
export const off = (function () {
|
|
27
|
+
// 移除事件监听器
|
|
28
|
+
if (!isServer && document.removeEventListener) {
|
|
29
|
+
return function (element, event, handler) {
|
|
30
|
+
if (element && event) {
|
|
31
|
+
element.removeEventListener(event, handler, false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
} else {
|
|
35
|
+
return function (element, event, handler) {
|
|
36
|
+
if (element && event) {
|
|
37
|
+
element.detachEvent('on' + event, handler);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { inBrowser } from '../utils/env';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
data() {
|
|
5
|
-
return {
|
|
6
|
-
language: inBrowser ? document.documentElement.lang || 'en' : 'en' // 初始语言
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
mounted() {
|
|
10
|
-
if (inBrowser) {
|
|
11
|
-
this.updateLanguage();
|
|
12
|
-
this.setupLanguageObserver();
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
methods: {
|
|
16
|
-
updateLanguage() {
|
|
17
|
-
this.language = document.documentElement.lang || 'en';
|
|
18
|
-
},
|
|
19
|
-
setupLanguageObserver() {
|
|
20
|
-
const observer = new MutationObserver(() => {
|
|
21
|
-
this.updateLanguage();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
observer.observe(document.documentElement, {
|
|
25
|
-
attributes: true,
|
|
26
|
-
attributeFilter: ['lang']
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// 在组件销毁时断开观察者
|
|
30
|
-
this.$once('hook:beforeDestroy', () => {
|
|
31
|
-
observer.disconnect();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
watch: {
|
|
36
|
-
// language(newLang) {
|
|
37
|
-
// // 当 language 变化时执行的操作
|
|
38
|
-
// console.log('Language changed to:', newLang);
|
|
39
|
-
// }
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
import { inBrowser } from '../utils/env';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
data() {
|
|
5
|
+
return {
|
|
6
|
+
language: inBrowser ? document.documentElement.lang || 'en' : 'en' // 初始语言
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
mounted() {
|
|
10
|
+
if (inBrowser) {
|
|
11
|
+
this.updateLanguage();
|
|
12
|
+
this.setupLanguageObserver();
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
methods: {
|
|
16
|
+
updateLanguage() {
|
|
17
|
+
this.language = document.documentElement.lang || 'en';
|
|
18
|
+
},
|
|
19
|
+
setupLanguageObserver() {
|
|
20
|
+
const observer = new MutationObserver(() => {
|
|
21
|
+
this.updateLanguage();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
observer.observe(document.documentElement, {
|
|
25
|
+
attributes: true,
|
|
26
|
+
attributeFilter: ['lang']
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// 在组件销毁时断开观察者
|
|
30
|
+
this.$once('hook:beforeDestroy', () => {
|
|
31
|
+
observer.disconnect();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
watch: {
|
|
36
|
+
// language(newLang) {
|
|
37
|
+
// // 当 language 变化时执行的操作
|
|
38
|
+
// console.log('Language changed to:', newLang);
|
|
39
|
+
// }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
// outlineConfigPlugin.js
|
|
2
|
-
import { inBrowser } from '../utils/env'
|
|
3
|
-
// __debug=1&__debug_vdesign_token=1
|
|
4
|
-
const OutlineConfig = {
|
|
5
|
-
install(Vue, options = {}) {
|
|
6
|
-
const outlineConfig = Vue.observable({
|
|
7
|
-
outlineEnabled: options.outlineEnabled ||false,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
Vue.prototype.$outlineConfig = outlineConfig;
|
|
11
|
-
|
|
12
|
-
Vue.mixin({
|
|
13
|
-
created() {
|
|
14
|
-
if (inBrowser) {
|
|
15
|
-
this.$outlineConfig.outlineEnabled = this.shouldEnableOutline()
|
|
16
|
-
this.$watch('$outlineConfig.outlineEnabled', (newValue) => {
|
|
17
|
-
document.documentElement.style.setProperty('--outline-visible', newValue ? '1px' : '0');
|
|
18
|
-
}, { immediate: true });
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
methods:{
|
|
22
|
-
shouldEnableOutline() {
|
|
23
|
-
if (!inBrowser) {
|
|
24
|
-
// 如果是在服务端渲染,返回默认值 false
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
// 获取URL的查询参数部分
|
|
28
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
29
|
-
// 对于哈希模式,也解析哈希中的查询字符串
|
|
30
|
-
const hashParams = window.location.hash.split('?')[1] ? new URLSearchParams(window.location.hash.split('?')[1]) : null;
|
|
31
|
-
|
|
32
|
-
// 检查查询参数或哈希中的参数
|
|
33
|
-
const debug = searchParams.has('__debug') || (hashParams && hashParams.has('__debug')) ? searchParams.get('__debug') === '1' || (hashParams && hashParams.get('__debug') === '1') : false;
|
|
34
|
-
const vdesignToken = searchParams.has('__debug_vdesign_token') || (hashParams && hashParams.has('__debug_vdesign_token')) ? searchParams.get('__debug_vdesign_token') === '1' || (hashParams && hashParams.get('__debug_vdesign_token') === '1') : false;
|
|
35
|
-
|
|
36
|
-
return debug && vdesignToken;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export default OutlineConfig;
|
|
1
|
+
// outlineConfigPlugin.js
|
|
2
|
+
import { inBrowser } from '../utils/env'
|
|
3
|
+
// __debug=1&__debug_vdesign_token=1
|
|
4
|
+
const OutlineConfig = {
|
|
5
|
+
install(Vue, options = {}) {
|
|
6
|
+
const outlineConfig = Vue.observable({
|
|
7
|
+
outlineEnabled: options.outlineEnabled ||false,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
Vue.prototype.$outlineConfig = outlineConfig;
|
|
11
|
+
|
|
12
|
+
Vue.mixin({
|
|
13
|
+
created() {
|
|
14
|
+
if (inBrowser) {
|
|
15
|
+
this.$outlineConfig.outlineEnabled = this.shouldEnableOutline()
|
|
16
|
+
this.$watch('$outlineConfig.outlineEnabled', (newValue) => {
|
|
17
|
+
document.documentElement.style.setProperty('--outline-visible', newValue ? '1px' : '0');
|
|
18
|
+
}, { immediate: true });
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
methods:{
|
|
22
|
+
shouldEnableOutline() {
|
|
23
|
+
if (!inBrowser) {
|
|
24
|
+
// 如果是在服务端渲染,返回默认值 false
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// 获取URL的查询参数部分
|
|
28
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
29
|
+
// 对于哈希模式,也解析哈希中的查询字符串
|
|
30
|
+
const hashParams = window.location.hash.split('?')[1] ? new URLSearchParams(window.location.hash.split('?')[1]) : null;
|
|
31
|
+
|
|
32
|
+
// 检查查询参数或哈希中的参数
|
|
33
|
+
const debug = searchParams.has('__debug') || (hashParams && hashParams.has('__debug')) ? searchParams.get('__debug') === '1' || (hashParams && hashParams.get('__debug') === '1') : false;
|
|
34
|
+
const vdesignToken = searchParams.has('__debug_vdesign_token') || (hashParams && hashParams.has('__debug_vdesign_token')) ? searchParams.get('__debug_vdesign_token') === '1' || (hashParams && hashParams.get('__debug_vdesign_token') === '1') : false;
|
|
35
|
+
|
|
36
|
+
return debug && vdesignToken;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default OutlineConfig;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* add Vue-Router support
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
props: {
|
|
7
|
-
url: String,
|
|
8
|
-
replace: Boolean,
|
|
9
|
-
to: [String, Object]
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
methods: {
|
|
13
|
-
routerLink() {
|
|
14
|
-
const { to, url, $router, replace } = this;
|
|
15
|
-
if (to && $router) {
|
|
16
|
-
$router[replace ? 'replace' : 'push'](to);
|
|
17
|
-
} else if (url) {
|
|
18
|
-
replace ? location.replace(url) : location.href = url;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* add Vue-Router support
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
props: {
|
|
7
|
+
url: String,
|
|
8
|
+
replace: Boolean,
|
|
9
|
+
to: [String, Object]
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
methods: {
|
|
13
|
+
routerLink() {
|
|
14
|
+
const { to, url, $router, replace } = this;
|
|
15
|
+
if (to && $router) {
|
|
16
|
+
$router[replace ? 'replace' : 'push'](to);
|
|
17
|
+
} else if (url) {
|
|
18
|
+
replace ? location.replace(url) : location.href = url;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
23
|
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// import Vue from 'vue'
|
|
2
|
-
import { inBrowser } from '../utils/env';
|
|
3
|
-
|
|
4
|
-
export const themeMixin = {
|
|
5
|
-
data() {
|
|
6
|
-
return {
|
|
7
|
-
theme: 'light' // 设置默认主题
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
|
-
mounted() {
|
|
11
|
-
if (inBrowser) {
|
|
12
|
-
// 在客户端环境中,可以安全地访问 'document'
|
|
13
|
-
this.theme = document.documentElement.getAttribute('theme') || 'light';
|
|
14
|
-
this.observeThemeChanges(); // 开始监听主题变化
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
methods: {
|
|
18
|
-
observeThemeChanges() {
|
|
19
|
-
if (inBrowser) {
|
|
20
|
-
// 创建一个 MutationObserver 实例
|
|
21
|
-
const observer = new MutationObserver((mutations) => {
|
|
22
|
-
mutations.forEach((mutation) => {
|
|
23
|
-
// 检查变化的属性是否为 'theme'
|
|
24
|
-
if (mutation.attributeName === 'theme') {
|
|
25
|
-
// 更新组件的主题
|
|
26
|
-
this.theme = document.documentElement.getAttribute('theme') || 'light';
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// 配置观察器,监视 html 元素的属性变化
|
|
32
|
-
observer.observe(document.documentElement, {
|
|
33
|
-
attributes: true // 仅监视属性变化
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 在组件销毁时断开观察器
|
|
37
|
-
this.$once('hook:beforeDestroy', () => {
|
|
38
|
-
observer.disconnect();
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
1
|
+
// import Vue from 'vue'
|
|
2
|
+
import { inBrowser } from '../utils/env';
|
|
3
|
+
|
|
4
|
+
export const themeMixin = {
|
|
5
|
+
data() {
|
|
6
|
+
return {
|
|
7
|
+
theme: 'light' // 设置默认主题
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
mounted() {
|
|
11
|
+
if (inBrowser) {
|
|
12
|
+
// 在客户端环境中,可以安全地访问 'document'
|
|
13
|
+
this.theme = document.documentElement.getAttribute('theme') || 'light';
|
|
14
|
+
this.observeThemeChanges(); // 开始监听主题变化
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
observeThemeChanges() {
|
|
19
|
+
if (inBrowser) {
|
|
20
|
+
// 创建一个 MutationObserver 实例
|
|
21
|
+
const observer = new MutationObserver((mutations) => {
|
|
22
|
+
mutations.forEach((mutation) => {
|
|
23
|
+
// 检查变化的属性是否为 'theme'
|
|
24
|
+
if (mutation.attributeName === 'theme') {
|
|
25
|
+
// 更新组件的主题
|
|
26
|
+
this.theme = document.documentElement.getAttribute('theme') || 'light';
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// 配置观察器,监视 html 元素的属性变化
|
|
32
|
+
observer.observe(document.documentElement, {
|
|
33
|
+
attributes: true // 仅监视属性变化
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 在组件销毁时断开观察器
|
|
37
|
+
this.$once('hook:beforeDestroy', () => {
|
|
38
|
+
observer.disconnect();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|