vdesign-ui 0.3.0 → 0.3.1
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 +511 -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.css +1 -1
- package/dist/vdesign-ui.umd.js +83 -83
- package/package.json +113 -113
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vd-step" :class="'vd-step-' + direction">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script>
|
|
7
|
-
export default {
|
|
8
|
-
name: 'vd-step',
|
|
9
|
-
props: {
|
|
10
|
-
// 激活状态
|
|
11
|
-
active: {
|
|
12
|
-
type: Array,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
// 显示方向
|
|
16
|
-
direction: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: 'horizontal' // horizontal|vertical|basic
|
|
19
|
-
},
|
|
20
|
-
// 置灰颜色
|
|
21
|
-
color: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: ''
|
|
24
|
-
},
|
|
25
|
-
// 激活颜色
|
|
26
|
-
activeColor: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ''
|
|
29
|
-
},
|
|
30
|
-
// 置灰图标
|
|
31
|
-
icon: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: ''
|
|
34
|
-
},
|
|
35
|
-
// 激活图标
|
|
36
|
-
activeIcon: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: ''
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
data() {
|
|
42
|
-
return {}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
46
|
-
<style lang="less">
|
|
47
|
-
@import './style.less';
|
|
48
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-step" :class="'vd-step-' + direction">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'vd-step',
|
|
9
|
+
props: {
|
|
10
|
+
// 激活状态
|
|
11
|
+
active: {
|
|
12
|
+
type: Array,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
// 显示方向
|
|
16
|
+
direction: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'horizontal' // horizontal|vertical|basic
|
|
19
|
+
},
|
|
20
|
+
// 置灰颜色
|
|
21
|
+
color: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ''
|
|
24
|
+
},
|
|
25
|
+
// 激活颜色
|
|
26
|
+
activeColor: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ''
|
|
29
|
+
},
|
|
30
|
+
// 置灰图标
|
|
31
|
+
icon: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ''
|
|
34
|
+
},
|
|
35
|
+
// 激活图标
|
|
36
|
+
activeIcon: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
data() {
|
|
42
|
+
return {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
<style lang="less">
|
|
47
|
+
@import './style.less';
|
|
48
|
+
</style>
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
@prefix: ~"vd-step";
|
|
2
|
-
|
|
3
|
-
.@{prefix} {
|
|
4
|
-
transform: translateX(0);
|
|
5
|
-
width: 100%;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
|
|
8
|
-
&.vd-step-horizontal {
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
|
|
12
|
-
.vd-step-item {
|
|
13
|
-
|
|
14
|
-
&:first-child {
|
|
15
|
-
.vd-step-u-line {
|
|
16
|
-
width: 50%;
|
|
17
|
-
|
|
18
|
-
&::after {
|
|
19
|
-
width: 0%;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&:last-child {
|
|
25
|
-
.vd-step-u-line {
|
|
26
|
-
width: 50%;
|
|
27
|
-
// inset-inline-end: 50%;
|
|
28
|
-
right: 50%;
|
|
29
|
-
|
|
30
|
-
&::after {
|
|
31
|
-
width: 100%;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.vd-step-vertical {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
flex-wrap: nowrap;
|
|
42
|
-
padding-block-start: var(--spacing-steps-vertical-padding_x);
|
|
43
|
-
padding-block-end: var(--spacing-steps-vertical-padding_x);
|
|
44
|
-
|
|
45
|
-
.vd-step-item {
|
|
46
|
-
|
|
47
|
-
&:last-child {
|
|
48
|
-
.vd-step-u-line {
|
|
49
|
-
display: none;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&.vd-step-basic {
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: space-between;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[lang|='ar'], [dir='rtl'] {
|
|
62
|
-
.vd-step.vd-step-horizontal .vd-step-item:last-child .vd-step-u-line {
|
|
63
|
-
right: inherit;
|
|
64
|
-
left: 50%;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
@prefix: ~"vd-step";
|
|
2
|
+
|
|
3
|
+
.@{prefix} {
|
|
4
|
+
transform: translateX(0);
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
&.vd-step-horizontal {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
|
|
12
|
+
.vd-step-item {
|
|
13
|
+
|
|
14
|
+
&:first-child {
|
|
15
|
+
.vd-step-u-line {
|
|
16
|
+
width: 50%;
|
|
17
|
+
|
|
18
|
+
&::after {
|
|
19
|
+
width: 0%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:last-child {
|
|
25
|
+
.vd-step-u-line {
|
|
26
|
+
width: 50%;
|
|
27
|
+
// inset-inline-end: 50%;
|
|
28
|
+
right: 50%;
|
|
29
|
+
|
|
30
|
+
&::after {
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.vd-step-vertical {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
flex-wrap: nowrap;
|
|
42
|
+
padding-block-start: var(--spacing-steps-vertical-padding_x);
|
|
43
|
+
padding-block-end: var(--spacing-steps-vertical-padding_x);
|
|
44
|
+
|
|
45
|
+
.vd-step-item {
|
|
46
|
+
|
|
47
|
+
&:last-child {
|
|
48
|
+
.vd-step-u-line {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.vd-step-basic {
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[lang|='ar'], [dir='rtl'] {
|
|
62
|
+
.vd-step.vd-step-horizontal .vd-step-item:last-child .vd-step-u-line {
|
|
63
|
+
right: inherit;
|
|
64
|
+
left: 50%;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import StepItem from './index.vue';
|
|
2
|
-
import './style.less';
|
|
3
|
-
StepItem.install = function (Vue) {
|
|
4
|
-
Vue.component(StepItem.name, StepItem)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default StepItem;
|
|
1
|
+
import StepItem from './index.vue';
|
|
2
|
+
import './style.less';
|
|
3
|
+
StepItem.install = function (Vue) {
|
|
4
|
+
Vue.component(StepItem.name, StepItem)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default StepItem;
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 标签选项 -->
|
|
3
|
-
<div class="vd-step-item" :class="[
|
|
4
|
-
'vd-step-' + parentProps.direction,
|
|
5
|
-
state ? 'vd-step-' + state : '',
|
|
6
|
-
isActive ? 'vd-step-active' : ''
|
|
7
|
-
]" :style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
8
|
-
<!-- 点 -->
|
|
9
|
-
<div v-if="parentProps.direction !== 'basic'" class="vd-step-u-dot"
|
|
10
|
-
:style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
11
|
-
<vd-icon v-if="state" :svg="true" :name="iconName"></vd-icon>
|
|
12
|
-
</div>
|
|
13
|
-
<!-- 线 -->
|
|
14
|
-
<div class="vd-step-u-line" :style="`background:${isActive ? parentProps.activeColor : parentProps.color};`"></div>
|
|
15
|
-
<!-- 文本 -->
|
|
16
|
-
<div v-if="parentProps.direction !== 'basic'" class="vd-step-u-text"
|
|
17
|
-
:style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
18
|
-
<div class="vd-step-u-text__title" v-if="customTitle">
|
|
19
|
-
<slot name="title"></slot>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="vd-step-u-text__title" v-else>{{ title }}</div>
|
|
22
|
-
<div class="vd-step-u-text__description" v-if="customDescription">
|
|
23
|
-
<slot name="description"></slot>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="vd-step-u-text__description" v-else>{{ description }}</div>
|
|
26
|
-
<slot></slot>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
|
-
<script>
|
|
32
|
-
import VdIcon from '../icon';
|
|
33
|
-
import { inBrowser } from '../utils/env';
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
name: 'vd-step-item',
|
|
37
|
-
components: {
|
|
38
|
-
VdIcon
|
|
39
|
-
},
|
|
40
|
-
props: {
|
|
41
|
-
// 索引名称
|
|
42
|
-
name: {
|
|
43
|
-
type: [String, Number],
|
|
44
|
-
required: true
|
|
45
|
-
},
|
|
46
|
-
title: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: '',
|
|
49
|
-
},
|
|
50
|
-
description: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: '',
|
|
53
|
-
},
|
|
54
|
-
state: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: '',
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
data() {
|
|
60
|
-
return {
|
|
61
|
-
isActive: false, // 激活状态
|
|
62
|
-
currentTheme: 'light', // 默认值
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
computed: {
|
|
66
|
-
// 父组件参数
|
|
67
|
-
parentProps() {
|
|
68
|
-
const { $options, _props } = this.$parent
|
|
69
|
-
return $options._componentTag === 'vd-step' ? _props : {}
|
|
70
|
-
},
|
|
71
|
-
customTitle() {
|
|
72
|
-
return !!this.$slots.title
|
|
73
|
-
},
|
|
74
|
-
customDescription() {
|
|
75
|
-
return !!this.$slots.description
|
|
76
|
-
},
|
|
77
|
-
iconName() {
|
|
78
|
-
if (this.state === 'afoot') {
|
|
79
|
-
return this.currentTheme === 'dark' ? 'icon_show_steping1_svg' : 'icon_show_steping_svg'
|
|
80
|
-
} else if (this.state === 'warning') {
|
|
81
|
-
return this.currentTheme === 'dark' ? 'icon_show_stepwrong1_svg' : 'icon_show_stepwrong_svg'
|
|
82
|
-
}
|
|
83
|
-
return ''
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
mounted() {
|
|
87
|
-
if (inBrowser) {
|
|
88
|
-
const theme = document.querySelector('html').getAttribute('theme');
|
|
89
|
-
this.currentTheme = theme || this.currentTheme;
|
|
90
|
-
this.observeThemeChange();
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
watch: {
|
|
94
|
-
// 监听父组件参数
|
|
95
|
-
parentProps: {
|
|
96
|
-
handler() {
|
|
97
|
-
this.isActive = this.parentProps.active.includes(this.name)
|
|
98
|
-
},
|
|
99
|
-
deep: true,
|
|
100
|
-
immediate: true
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
methods: {
|
|
104
|
-
observeThemeChange() {
|
|
105
|
-
if (!inBrowser) return; // SSR 环境中不执行
|
|
106
|
-
const observer = new MutationObserver(mutations => {
|
|
107
|
-
mutations.forEach(mutation => {
|
|
108
|
-
if (mutation.type === 'attributes' && mutation.attributeName === 'theme') {
|
|
109
|
-
const theme = document.querySelector('html').getAttribute('theme')
|
|
110
|
-
this.currentTheme = theme ? theme : this.currentTheme
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
observer.observe(document.querySelector('html'), { attributes: true })
|
|
115
|
-
|
|
116
|
-
this.$once('hook:beforeDestroy', () => {
|
|
117
|
-
observer.disconnect()
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
</script>
|
|
123
|
-
|
|
124
|
-
<style lang="less">
|
|
125
|
-
@import './style.less';
|
|
126
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 标签选项 -->
|
|
3
|
+
<div class="vd-step-item" :class="[
|
|
4
|
+
'vd-step-' + parentProps.direction,
|
|
5
|
+
state ? 'vd-step-' + state : '',
|
|
6
|
+
isActive ? 'vd-step-active' : ''
|
|
7
|
+
]" :style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
8
|
+
<!-- 点 -->
|
|
9
|
+
<div v-if="parentProps.direction !== 'basic'" class="vd-step-u-dot"
|
|
10
|
+
:style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
11
|
+
<vd-icon v-if="state" :svg="true" :name="iconName"></vd-icon>
|
|
12
|
+
</div>
|
|
13
|
+
<!-- 线 -->
|
|
14
|
+
<div class="vd-step-u-line" :style="`background:${isActive ? parentProps.activeColor : parentProps.color};`"></div>
|
|
15
|
+
<!-- 文本 -->
|
|
16
|
+
<div v-if="parentProps.direction !== 'basic'" class="vd-step-u-text"
|
|
17
|
+
:style="`color:${isActive ? parentProps.activeColor : parentProps.color};`">
|
|
18
|
+
<div class="vd-step-u-text__title" v-if="customTitle">
|
|
19
|
+
<slot name="title"></slot>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="vd-step-u-text__title" v-else>{{ title }}</div>
|
|
22
|
+
<div class="vd-step-u-text__description" v-if="customDescription">
|
|
23
|
+
<slot name="description"></slot>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="vd-step-u-text__description" v-else>{{ description }}</div>
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import VdIcon from '../icon';
|
|
33
|
+
import { inBrowser } from '../utils/env';
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'vd-step-item',
|
|
37
|
+
components: {
|
|
38
|
+
VdIcon
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
// 索引名称
|
|
42
|
+
name: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
title: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '',
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '',
|
|
53
|
+
},
|
|
54
|
+
state: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
isActive: false, // 激活状态
|
|
62
|
+
currentTheme: 'light', // 默认值
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
// 父组件参数
|
|
67
|
+
parentProps() {
|
|
68
|
+
const { $options, _props } = this.$parent
|
|
69
|
+
return $options._componentTag === 'vd-step' ? _props : {}
|
|
70
|
+
},
|
|
71
|
+
customTitle() {
|
|
72
|
+
return !!this.$slots.title
|
|
73
|
+
},
|
|
74
|
+
customDescription() {
|
|
75
|
+
return !!this.$slots.description
|
|
76
|
+
},
|
|
77
|
+
iconName() {
|
|
78
|
+
if (this.state === 'afoot') {
|
|
79
|
+
return this.currentTheme === 'dark' ? 'icon_show_steping1_svg' : 'icon_show_steping_svg'
|
|
80
|
+
} else if (this.state === 'warning') {
|
|
81
|
+
return this.currentTheme === 'dark' ? 'icon_show_stepwrong1_svg' : 'icon_show_stepwrong_svg'
|
|
82
|
+
}
|
|
83
|
+
return ''
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
mounted() {
|
|
87
|
+
if (inBrowser) {
|
|
88
|
+
const theme = document.querySelector('html').getAttribute('theme');
|
|
89
|
+
this.currentTheme = theme || this.currentTheme;
|
|
90
|
+
this.observeThemeChange();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
// 监听父组件参数
|
|
95
|
+
parentProps: {
|
|
96
|
+
handler() {
|
|
97
|
+
this.isActive = this.parentProps.active.includes(this.name)
|
|
98
|
+
},
|
|
99
|
+
deep: true,
|
|
100
|
+
immediate: true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
methods: {
|
|
104
|
+
observeThemeChange() {
|
|
105
|
+
if (!inBrowser) return; // SSR 环境中不执行
|
|
106
|
+
const observer = new MutationObserver(mutations => {
|
|
107
|
+
mutations.forEach(mutation => {
|
|
108
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'theme') {
|
|
109
|
+
const theme = document.querySelector('html').getAttribute('theme')
|
|
110
|
+
this.currentTheme = theme ? theme : this.currentTheme
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
observer.observe(document.querySelector('html'), { attributes: true })
|
|
115
|
+
|
|
116
|
+
this.$once('hook:beforeDestroy', () => {
|
|
117
|
+
observer.disconnect()
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<style lang="less">
|
|
125
|
+
@import './style.less';
|
|
126
|
+
</style>
|