# 标签页
用于让用户在不同的视图中进行切换。
使用规则
一级 Tab(插件首页)
多用于插件页首页顶部一级导航内
标签文字:建议控制在 2-4 个字内
标签数量:2 个
文案命名:默认显示设备名称,设备命名为设备简称,例如”立式空调”;用户自定义后,优先显示用户自定义名称
一级 Tab(二级页面中)
用于一级导航中已含有 Tab 时
标签文字:建议控制在 2-4 个字内
标签数量:超过 4 个,支持左右滑动
二级 Tab 样式1
用于二级 tab 导航
标签文字:建议控制在 2-4 个字内
标签数量:2-5 个为固定,超过5个左右滑动
二级 Tab 样式2
用于二级 tab 导航
标签文字:建议控制在 2-4 个字内
标签数量:最多 5 个
# 示例
<template>
<div class="wrapper">
<dof-minibar title="3.2标签页tab"></dof-minibar>
<scroller>
<div class="title-box">
<text class="title-text">一级 Tab(插件首页)</text>
</div>
<dof-minibar :right-button="'default'">
<dof-tab-page
type="primary"
slot="middle"
:is-slot="true"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="navTabTitles"
></dof-tab-page>
</dof-minibar>
<div class="title-box">
<text class="title-text">一级 Tab(二级页面中)</text>
</div>
<dof-tab-page
type="primary"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo1x"
></dof-tab-page>
<dof-tab-page
type="primary"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo2"
></dof-tab-page>
<dof-tab-page
type="primary"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo2x"
></dof-tab-page>
<dof-tab-page
type="primary"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo5"
></dof-tab-page>
<div class="title-box">
<text class="title-text">二级 Tab 样式1</text>
</div>
<dof-tab-page
ref="dof-tab-page"
type="third"
:tab-titles="demo4"
:tab-checked-index="0"
:has-margin="true"
></dof-tab-page>
<dof-tab-page
ref="dof-tab-page"
type="third"
:tab-titles="demo5"
:tab-checked-index="0"
:has-margin="true"
></dof-tab-page>
<div class="title-box">
<text class="title-text">二级 Tab 样式2</text>
</div>
<dof-tab-page
theme="default"
type="third-group"
:has-margin="true"
:tab-checked-index="0"
:tabTitles="btnGroup[0]"
></dof-tab-page>
<dof-tab-page
theme="default"
type="third-group"
:has-margin="true"
:tab-checked-index="0"
:tabTitles="btnGroup[1]"
></dof-tab-page>
<dof-tab-page
theme="default"
type="third-group"
:has-margin="true"
:tab-checked-index="0"
:tabTitles="btnGroup[2]"
></dof-tab-page>
<div class="title-box">
<text class="title-text">二级 Tab 样式3</text>
</div>
<div class="tab-page-box">
<dof-tab-page
style="flex: 1;"
type="primary"
:isFlexStart="true"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo1x"
></dof-tab-page>
<div class="more-box">
<text style="font-size: 24px; color: rgba(255,255,255,0.40); margin-right: 8px;">更多</text>
<dof-iconfont :code="'\u4713'" :size="40" :color="'rgba(255,255,255,0.40)'"></dof-iconfont>
</div>
</div>
<div class="tab-page-box">
<dof-tab-page
style="flex: 1;"
type="primary"
:isFlexStart="true"
slot="middle"
:has-margin="true"
ref="dof-tab-page"
:tab-titles="demo2"
></dof-tab-page>
<div class="more-box">
<text style="font-size: 24px; color: rgba(255,255,255,0.40); margin-right: 8px;">更多</text>
<dof-iconfont :code="'\u4713'" :size="40" :color="'rgba(255,255,255,0.40)'"></dof-iconfont>
</div>
</div>
<div style="height: 100px"></div>
</scroller>
</div>
</template>
<style scoped>
.wrapper {
background-color: #f9f9f9;
}
.title-box {
padding: 32px;
background-color: #e5e5e8;
}
.title-text {
font-family: PingFangSC-Medium;
font-size: 36px;
color: #000000;
font-weight: 500;
}
.tab-page-box {
height: 112px;
background-color: #151617;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
padding-left: 32px;
padding-right: 32px;
}
.more-box {
display: flex;
flex-direction: row;
align-items: center;
}
@media screen and (weex-theme: colmo) {
.wrapper {
background-color: #000000;
}
}
</style>
<script>
import { DofMinibar, DofTabPage, DofIconfont } from 'dolphin-weex-ui'
import { demo1, demo1x, demo2, demo2x, demo3, demo4, demo5 } from './config'
export default {
components: { DofMinibar, DofTabPage, DofIconfont },
data: () => ({
navTabTitles: demo1,
demo1x,
demo2,
demo2x,
demo3,
demo4,
demo5,
btnGroup: [
['上桶', '下桶'],
['上下风', '左右风', '无风感'],
['1档', '2档', '3档', '4档']
]
}),
created() {},
methods: {}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Attributes
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| tab-titles | Array | Y | [] | 顶部 显示配置, 详见注1 |
| type | String | N | secondary | tab类型 primary(一级)/secondary(二级)/third(三级) |
| is-slot | Boolean | N | false | 是否作为插槽使用,如一级tab页面中作为minibar组件的插槽中使用 |
| has-margin | Boolean | N | false | 是否设置margin-bottom为16px |
| tab-checked-index | Number | N | 0 | 当前选中的的标签 |
| theme | String | N | default | 颜色主题:default/primary/purple/slate/aqua/turquoise/tomato/orange/yellow/gray |
| tabStyles | Object | N | {} | tab自定义样式,多用于三级tab, 详见注2 |
注1: tab-titles
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| title | String | N | - | 标题 |
| hasDotTip | Boolean | N | - | 徽标badge,显示为dot点 |
| hasDotNum | Number String | N | - | 徽标badge数字 |
| badgeMax | Number | N | - | 徽标内容最大值,如设置99, 则显示'99+' |
| badgeColor | String | N | red | 自定义徽标背景颜色 |
注2: tabStyles
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| bgColor | String | N | #151617 | 背景色 |
| titleColor | String | N | rgba(255,255,255,0.4) | 标题色 |
| activeTitleColor | String | N | rgba(255,255,255,0.8) | 标题高亮色 |
| isActiveTitleBold | Boolean | N | false | 标题高亮是否加粗 |
| activeBottomColor | String | N | #B35336 | 标题下划线颜色 |
# Events
| 事件名称 | 说明 | 回调参数 |
|---|---|---|
dofTabSelected | 选择并进入当前页面事件, 返回参数为:当前选中项index | index |
点我扫二维码 查看demo