vdesign-ui 0.2.19 → 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 -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 +333 -328
- 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 -348
- package/dist/components/tabs/style.less +504 -493
- 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 -97
- package/dist/components/toast/index.vue +50 -49
- package/dist/components/toast/style.less +58 -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 +9 -9
- package/dist/vdesign-ui.common.js +212 -161
- package/dist/vdesign-ui.css +1 -1
- package/dist/vdesign-ui.umd.js +212 -161
- package/dist/vdesign-ui.umd.min.js +2 -2
- package/package.json +113 -113
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vd-head-nav--placeholder" :style="{height:height + 'px'}">
|
|
3
|
-
<div class="vd-head-nav" :class="wrapClasses" :style="{zIndex:zIndex}" ref="headNav">
|
|
4
|
-
<div v-if="showLeftSection" class="vd-head-nav--left">
|
|
5
|
-
<!-- 左一icon -->
|
|
6
|
-
<span v-if="showSidebar" class="vd-head-nav__icon">
|
|
7
|
-
<slot name="left-primary">
|
|
8
|
-
<vd-icon name="icon_nav_sidebar"></vd-icon>
|
|
9
|
-
</slot>
|
|
10
|
-
</span>
|
|
11
|
-
<!-- 左二icon -->
|
|
12
|
-
<span v-if="$slots['left-secondary']" class="vd-head-nav__icon">
|
|
13
|
-
<slot name="left-secondary"></slot>
|
|
14
|
-
</span>
|
|
15
|
-
|
|
16
|
-
<!-- hno类型下的 左对齐文本-->
|
|
17
|
-
<span v-if="leftTitle" class="vd-head-nav__left-title">{{ leftTitle }}</span>
|
|
18
|
-
<!-- hno类型下的 编辑文本 -->
|
|
19
|
-
<span v-if="editLeftText" class="vd-head-nav__edit-left-text">{{ editLeftText }}</span>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div v-if="showContentSection" class="vd-head-nav__content" :class="contentClasses">
|
|
23
|
-
<!-- 标题选择器 -->
|
|
24
|
-
<div v-if="$slots.selector" class="vd-head-nav__content--selector">
|
|
25
|
-
<slot name="selector"></slot>
|
|
26
|
-
</div>
|
|
27
|
-
<!-- 标题 -->
|
|
28
|
-
<span v-if="title" class="vd-head-nav__title vd-ellipsis" :class="titleClasses">{{ title }}</span>
|
|
29
|
-
<!-- hno 副标题 -->
|
|
30
|
-
<span v-if="description" class="vd-head-nav__description">{{ description }}</span>
|
|
31
|
-
|
|
32
|
-
<!-- hno 股票价格 -->
|
|
33
|
-
<span class="vd-head-nav__stock" :class="stockColor" v-if="colors">
|
|
34
|
-
<!-- 股票开市状态 -->
|
|
35
|
-
<slot name="state"></slot>
|
|
36
|
-
<span class="vd-head-nav__price--price">{{ price }}</span>
|
|
37
|
-
<span class="vd-head-nav__price--chgp">{{ chgp }}</span>
|
|
38
|
-
<span class="vd-head-nav__price--chg">{{ chg }}</span>
|
|
39
|
-
</span>
|
|
40
|
-
|
|
41
|
-
<!-- hno title 账户类型选择器 -->
|
|
42
|
-
<slot name="selector-bottom"></slot>
|
|
43
|
-
<!-- hno 账户类型选择器结果 -->
|
|
44
|
-
<span v-if="accountIcon || accountType" class="vd-head-nav__icontype">
|
|
45
|
-
<vd-icon :name="accountIcon" class="vd-head-nav__account-type--icon"></vd-icon>
|
|
46
|
-
<span class="vd-head-nav__account-type">{{ accountType }}</span>
|
|
47
|
-
</span>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div class="vd-head-nav--right" v-if="showRightSection">
|
|
51
|
-
<!-- 右二icon -->
|
|
52
|
-
<span v-if="rightSecondary || $slots['right-secondary']" class="vd-head-nav__icon">
|
|
53
|
-
<slot name="right-secondary">
|
|
54
|
-
<vd-icon name="icon_nav_search" style="transform: scale(1);"></vd-icon>
|
|
55
|
-
</slot>
|
|
56
|
-
</span>
|
|
57
|
-
<!-- 右一icon -->
|
|
58
|
-
<span v-if="rightPrimary || $slots['right-primary']" class="vd-head-nav__icon">
|
|
59
|
-
<slot name="right-primary">
|
|
60
|
-
<vd-icon name="icon_nav_trade" style="transform: scale(1);"></vd-icon>
|
|
61
|
-
</slot>
|
|
62
|
-
</span>
|
|
63
|
-
|
|
64
|
-
<!-- hno-编辑右侧文字 -->
|
|
65
|
-
<span class="vd-head-nav__edit-right-text" v-if="editRightText">{{ editRightText }}</span>
|
|
66
|
-
<!-- hno-账户类型右侧文字 -->
|
|
67
|
-
<span class="vd-head-nav__account-text" v-if="accountText">{{ accountText }}</span>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<!-- 股票开市状态 -->
|
|
71
|
-
<div class="vd-head-nav__info" v-if="$slots['stock-time'] || time">
|
|
72
|
-
<slot name="stock-time"></slot>
|
|
73
|
-
<span v-if="time" class="vd-head-nav__time">{{ time }}</span>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script>
|
|
80
|
-
import { inBrowser } from '../utils/env'
|
|
81
|
-
import VdIcon from '../icon';
|
|
82
|
-
const prefixCls = 'vd-head-nav';
|
|
83
|
-
export default {
|
|
84
|
-
name: 'vd-head-nav',
|
|
85
|
-
components: {
|
|
86
|
-
VdIcon,
|
|
87
|
-
},
|
|
88
|
-
props: {
|
|
89
|
-
title: String, // 标题
|
|
90
|
-
time: String, // 标题下面的股票开市时间
|
|
91
|
-
type: String, // 默认hnp 设置normal为hno
|
|
92
|
-
leftPrimary: Boolean, // 左侧边栏图标,左一,有默认图标icon_nav_sidebar,也可以是同名slot
|
|
93
|
-
rightPrimary: Boolean, // 右侧边栏图标,右一,有默认图标icon_nav_search,也可以是同名slot
|
|
94
|
-
rightSecondary: Boolean, // 右侧边栏图标,右二,有默认图标icon_nav_trade,也可以是同名slot
|
|
95
|
-
start: Boolean, // hno类型下的,居左对齐
|
|
96
|
-
description: String, // 标题下面的描述文字
|
|
97
|
-
price: String, // 股票价格
|
|
98
|
-
chgp: String, // 股票涨跌百分比 如:+0.01%
|
|
99
|
-
chg: String, // 股票涨跌,如:+0.01
|
|
100
|
-
colors: String, // 股票涨跌颜色,默认rise,可选值fall,rise为涨,fall为跌
|
|
101
|
-
leftTitle: String, // hno类型下的,左侧边栏文字,字号大一些
|
|
102
|
-
editLeftText: String, // hno类型下的,编辑左边栏文字
|
|
103
|
-
editRightText: String, // hno类型下的,编辑右边栏文字
|
|
104
|
-
accountText: String, // 账户类型右侧边栏文字
|
|
105
|
-
accountType: String, // 账户类型文本
|
|
106
|
-
accountIcon: String, // 账户类型图标
|
|
107
|
-
fixed: Boolean, // 固定在顶部
|
|
108
|
-
zIndex: [Number, String], // 固定在顶部时,设置z-index
|
|
109
|
-
safeAreaInsetTop: Boolean, // 固定在顶部时,是否使用安全区域
|
|
110
|
-
placeholder: Boolean, // 是否使用占位,用于固定在顶部时,占位高度
|
|
111
|
-
},
|
|
112
|
-
data() {
|
|
113
|
-
return {
|
|
114
|
-
height: null,
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
computed: {
|
|
119
|
-
wrapClasses() {
|
|
120
|
-
return [
|
|
121
|
-
{
|
|
122
|
-
[`${prefixCls}--${this.type}`]: this.type,
|
|
123
|
-
[`${prefixCls}--fixed`]: this.fixed,
|
|
124
|
-
[`${prefixCls}--safe-area-inset-top`]: this.safeAreaInsetTop,
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
},
|
|
128
|
-
contentClasses() {
|
|
129
|
-
return [
|
|
130
|
-
{
|
|
131
|
-
'vd-head-nav__content--start': this.start,
|
|
132
|
-
}
|
|
133
|
-
];
|
|
134
|
-
},
|
|
135
|
-
titleClasses() {
|
|
136
|
-
return [
|
|
137
|
-
{
|
|
138
|
-
[`${prefixCls}__title--normal`]: this.type,
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
stockColor() {
|
|
143
|
-
return [
|
|
144
|
-
{
|
|
145
|
-
[`${prefixCls}__stock--${this.colors}`]: this.colors,
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
showSidebar() {
|
|
151
|
-
return this.leftPrimary || this.$slots['left-primary'];
|
|
152
|
-
},
|
|
153
|
-
showLeftSection() {
|
|
154
|
-
return this.showSidebar || this.$slots['left-secondary'] || this.leftTitle || this.editLeftText;
|
|
155
|
-
},
|
|
156
|
-
showContentSection() {
|
|
157
|
-
return this.title || this.description || this.$slots.selector || this.$slots['selector-bottom'] || this.accountIcon || this.accountType || this.colors;
|
|
158
|
-
},
|
|
159
|
-
showRightSection() {
|
|
160
|
-
return this.rightPrimary || this.$slots['right-primary'] || this.rightSecondary || this.$slots['right-secondary'] || this.editRightText || this.accountText;
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
methods: {
|
|
164
|
-
setHeight() {
|
|
165
|
-
if (this.$refs.headNav) {
|
|
166
|
-
this.height = this.$refs.headNav.getBoundingClientRect().height;
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
mounted() {
|
|
171
|
-
if (inBrowser && this.placeholder && this.fixed) {
|
|
172
|
-
this.setHeight();
|
|
173
|
-
const resizeHandler = () => {
|
|
174
|
-
requestAnimationFrame(this.setHeight); // 使用 requestAnimationFrame 优化性能
|
|
175
|
-
};
|
|
176
|
-
window.addEventListener('resize', resizeHandler);
|
|
177
|
-
this.$once('hook:beforeDestroy', () => window.removeEventListener('resize', resizeHandler));
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
}
|
|
181
|
-
</script>
|
|
182
|
-
|
|
183
|
-
<style lang="less">
|
|
184
|
-
@import './style.less';
|
|
185
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-head-nav--placeholder" :style="{height:height + 'px'}">
|
|
3
|
+
<div class="vd-head-nav" :class="wrapClasses" :style="{zIndex:zIndex}" ref="headNav">
|
|
4
|
+
<div v-if="showLeftSection" class="vd-head-nav--left">
|
|
5
|
+
<!-- 左一icon -->
|
|
6
|
+
<span v-if="showSidebar" class="vd-head-nav__icon">
|
|
7
|
+
<slot name="left-primary">
|
|
8
|
+
<vd-icon name="icon_nav_sidebar"></vd-icon>
|
|
9
|
+
</slot>
|
|
10
|
+
</span>
|
|
11
|
+
<!-- 左二icon -->
|
|
12
|
+
<span v-if="$slots['left-secondary']" class="vd-head-nav__icon">
|
|
13
|
+
<slot name="left-secondary"></slot>
|
|
14
|
+
</span>
|
|
15
|
+
|
|
16
|
+
<!-- hno类型下的 左对齐文本-->
|
|
17
|
+
<span v-if="leftTitle" class="vd-head-nav__left-title">{{ leftTitle }}</span>
|
|
18
|
+
<!-- hno类型下的 编辑文本 -->
|
|
19
|
+
<span v-if="editLeftText" class="vd-head-nav__edit-left-text">{{ editLeftText }}</span>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div v-if="showContentSection" class="vd-head-nav__content" :class="contentClasses">
|
|
23
|
+
<!-- 标题选择器 -->
|
|
24
|
+
<div v-if="$slots.selector" class="vd-head-nav__content--selector">
|
|
25
|
+
<slot name="selector"></slot>
|
|
26
|
+
</div>
|
|
27
|
+
<!-- 标题 -->
|
|
28
|
+
<span v-if="title" class="vd-head-nav__title vd-ellipsis" :class="titleClasses">{{ title }}</span>
|
|
29
|
+
<!-- hno 副标题 -->
|
|
30
|
+
<span v-if="description" class="vd-head-nav__description">{{ description }}</span>
|
|
31
|
+
|
|
32
|
+
<!-- hno 股票价格 -->
|
|
33
|
+
<span class="vd-head-nav__stock" :class="stockColor" v-if="colors">
|
|
34
|
+
<!-- 股票开市状态 -->
|
|
35
|
+
<slot name="state"></slot>
|
|
36
|
+
<span class="vd-head-nav__price--price">{{ price }}</span>
|
|
37
|
+
<span class="vd-head-nav__price--chgp">{{ chgp }}</span>
|
|
38
|
+
<span class="vd-head-nav__price--chg">{{ chg }}</span>
|
|
39
|
+
</span>
|
|
40
|
+
|
|
41
|
+
<!-- hno title 账户类型选择器 -->
|
|
42
|
+
<slot name="selector-bottom"></slot>
|
|
43
|
+
<!-- hno 账户类型选择器结果 -->
|
|
44
|
+
<span v-if="accountIcon || accountType" class="vd-head-nav__icontype">
|
|
45
|
+
<vd-icon :name="accountIcon" class="vd-head-nav__account-type--icon"></vd-icon>
|
|
46
|
+
<span class="vd-head-nav__account-type">{{ accountType }}</span>
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="vd-head-nav--right" v-if="showRightSection">
|
|
51
|
+
<!-- 右二icon -->
|
|
52
|
+
<span v-if="rightSecondary || $slots['right-secondary']" class="vd-head-nav__icon">
|
|
53
|
+
<slot name="right-secondary">
|
|
54
|
+
<vd-icon name="icon_nav_search" style="transform: scale(1);"></vd-icon>
|
|
55
|
+
</slot>
|
|
56
|
+
</span>
|
|
57
|
+
<!-- 右一icon -->
|
|
58
|
+
<span v-if="rightPrimary || $slots['right-primary']" class="vd-head-nav__icon">
|
|
59
|
+
<slot name="right-primary">
|
|
60
|
+
<vd-icon name="icon_nav_trade" style="transform: scale(1);"></vd-icon>
|
|
61
|
+
</slot>
|
|
62
|
+
</span>
|
|
63
|
+
|
|
64
|
+
<!-- hno-编辑右侧文字 -->
|
|
65
|
+
<span class="vd-head-nav__edit-right-text" v-if="editRightText">{{ editRightText }}</span>
|
|
66
|
+
<!-- hno-账户类型右侧文字 -->
|
|
67
|
+
<span class="vd-head-nav__account-text" v-if="accountText">{{ accountText }}</span>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<!-- 股票开市状态 -->
|
|
71
|
+
<div class="vd-head-nav__info" v-if="$slots['stock-time'] || time">
|
|
72
|
+
<slot name="stock-time"></slot>
|
|
73
|
+
<span v-if="time" class="vd-head-nav__time">{{ time }}</span>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script>
|
|
80
|
+
import { inBrowser } from '../utils/env'
|
|
81
|
+
import VdIcon from '../icon';
|
|
82
|
+
const prefixCls = 'vd-head-nav';
|
|
83
|
+
export default {
|
|
84
|
+
name: 'vd-head-nav',
|
|
85
|
+
components: {
|
|
86
|
+
VdIcon,
|
|
87
|
+
},
|
|
88
|
+
props: {
|
|
89
|
+
title: String, // 标题
|
|
90
|
+
time: String, // 标题下面的股票开市时间
|
|
91
|
+
type: String, // 默认hnp 设置normal为hno
|
|
92
|
+
leftPrimary: Boolean, // 左侧边栏图标,左一,有默认图标icon_nav_sidebar,也可以是同名slot
|
|
93
|
+
rightPrimary: Boolean, // 右侧边栏图标,右一,有默认图标icon_nav_search,也可以是同名slot
|
|
94
|
+
rightSecondary: Boolean, // 右侧边栏图标,右二,有默认图标icon_nav_trade,也可以是同名slot
|
|
95
|
+
start: Boolean, // hno类型下的,居左对齐
|
|
96
|
+
description: String, // 标题下面的描述文字
|
|
97
|
+
price: String, // 股票价格
|
|
98
|
+
chgp: String, // 股票涨跌百分比 如:+0.01%
|
|
99
|
+
chg: String, // 股票涨跌,如:+0.01
|
|
100
|
+
colors: String, // 股票涨跌颜色,默认rise,可选值fall,rise为涨,fall为跌
|
|
101
|
+
leftTitle: String, // hno类型下的,左侧边栏文字,字号大一些
|
|
102
|
+
editLeftText: String, // hno类型下的,编辑左边栏文字
|
|
103
|
+
editRightText: String, // hno类型下的,编辑右边栏文字
|
|
104
|
+
accountText: String, // 账户类型右侧边栏文字
|
|
105
|
+
accountType: String, // 账户类型文本
|
|
106
|
+
accountIcon: String, // 账户类型图标
|
|
107
|
+
fixed: Boolean, // 固定在顶部
|
|
108
|
+
zIndex: [Number, String], // 固定在顶部时,设置z-index
|
|
109
|
+
safeAreaInsetTop: Boolean, // 固定在顶部时,是否使用安全区域
|
|
110
|
+
placeholder: Boolean, // 是否使用占位,用于固定在顶部时,占位高度
|
|
111
|
+
},
|
|
112
|
+
data() {
|
|
113
|
+
return {
|
|
114
|
+
height: null,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
computed: {
|
|
119
|
+
wrapClasses() {
|
|
120
|
+
return [
|
|
121
|
+
{
|
|
122
|
+
[`${prefixCls}--${this.type}`]: this.type,
|
|
123
|
+
[`${prefixCls}--fixed`]: this.fixed,
|
|
124
|
+
[`${prefixCls}--safe-area-inset-top`]: this.safeAreaInsetTop,
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
contentClasses() {
|
|
129
|
+
return [
|
|
130
|
+
{
|
|
131
|
+
'vd-head-nav__content--start': this.start,
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
},
|
|
135
|
+
titleClasses() {
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
[`${prefixCls}__title--normal`]: this.type,
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
stockColor() {
|
|
143
|
+
return [
|
|
144
|
+
{
|
|
145
|
+
[`${prefixCls}__stock--${this.colors}`]: this.colors,
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
showSidebar() {
|
|
151
|
+
return this.leftPrimary || this.$slots['left-primary'];
|
|
152
|
+
},
|
|
153
|
+
showLeftSection() {
|
|
154
|
+
return this.showSidebar || this.$slots['left-secondary'] || this.leftTitle || this.editLeftText;
|
|
155
|
+
},
|
|
156
|
+
showContentSection() {
|
|
157
|
+
return this.title || this.description || this.$slots.selector || this.$slots['selector-bottom'] || this.accountIcon || this.accountType || this.colors;
|
|
158
|
+
},
|
|
159
|
+
showRightSection() {
|
|
160
|
+
return this.rightPrimary || this.$slots['right-primary'] || this.rightSecondary || this.$slots['right-secondary'] || this.editRightText || this.accountText;
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
methods: {
|
|
164
|
+
setHeight() {
|
|
165
|
+
if (this.$refs.headNav) {
|
|
166
|
+
this.height = this.$refs.headNav.getBoundingClientRect().height;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
mounted() {
|
|
171
|
+
if (inBrowser && this.placeholder && this.fixed) {
|
|
172
|
+
this.setHeight();
|
|
173
|
+
const resizeHandler = () => {
|
|
174
|
+
requestAnimationFrame(this.setHeight); // 使用 requestAnimationFrame 优化性能
|
|
175
|
+
};
|
|
176
|
+
window.addEventListener('resize', resizeHandler);
|
|
177
|
+
this.$once('hook:beforeDestroy', () => window.removeEventListener('resize', resizeHandler));
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
}
|
|
181
|
+
</script>
|
|
182
|
+
|
|
183
|
+
<style lang="less">
|
|
184
|
+
@import './style.less';
|
|
185
|
+
</style>
|