# 标签页
用于让用户在不同的视图中进行切换。
使用规则
一级 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 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;
}
@media screen and (weex-theme: colmo) {
.wrapper {
background-color: #000000;
}
}
</style>
<script>
import { DofMinibar, DofTabPage } from 'dolphin-weex-ui'
import { demo1, demo1x, demo2, demo2x, demo3, demo4, demo5 } from './config'
export default {
components: { DofMinibar, DofTabPage },
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
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
config.js配置:
export default {
tabTitles: [
{
title: '空调',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_01@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '洗衣机',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_04@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '冰箱',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_03@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '厨热',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_13@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '微清',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_09@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '电视',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_16@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '破壁机',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_13@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
},
{
title: '照明',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/smart/ico_smart_11@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/funs/ico_smart_home@3x.png'
}
],
tabStyles: {
bgColor: '#FFFFFF',
titleColor: '#666666',
activeTitleColor: '#3D3D3D',
activeBgColor: '#FFFFFF',
isActiveTitleBold: true,
iconWidth: 70,
iconHeight: 70,
width: 160,
height: 120,
fontSize: 24,
hasActiveBottom: true,
activeBottomColor: '#000000',
activeBottomHeight: 6,
activeBottomWidth: 120,
textPaddingLeft: 10,
textPaddingRight: 10,
normalBottomColor: 'rgba(0,0,0,0.4)',
normalBottomHeight: 2,
hasRightIcon: true,
rightOffset: 100
},
// 使用 iconfont 模式的tab title配置
tabIconFontTitles: [
{
title: '首页',
codePoint: '\ue623'
},
{
title: '特别推荐',
codePoint: '\ue608'
},
{
title: '消息中心',
codePoint: '\ue752',
badge: 5
},
{
title: '我的主页',
codePoint: '\ue601',
dot: true
}
],
tabIconFontStyles: {
bgColor: '#FFFFFF',
titleColor: '#666666',
activeTitleColor: '#3D3D3D',
activeBgColor: '#FFFFFF',
isActiveTitleBold: true,
width: 160,
height: 120,
fontSize: 24,
textPaddingLeft: 10,
textPaddingRight: 10,
iconFontSize: 50,
iconFontColor: '#333333',
iconFontMarginBottom: 8,
activeIconFontColor: 'red',
iconFontUrl: '//at.alicdn.com/t/font_501019_mauqv15evc1pp66r.ttf'
}
}
export const demo1 = [
{
title: '空调'
},
{
title: '推荐'
}
]
export const demo1x = [
{
title: '标签'
},
{
title: '标签'
}
]
export const demo2 = [
{
title: '标签'
},
{
title: '标签'
},
{
title: '标签'
}
]
export const demo2x = [
{
title: '标签'
},
{
title: '标签'
},
{
title: '标签'
},
{
title: '标签'
}
]
export const demo3 = [
{
title: '已选中'
},
{
title: '未选中'
},
{
title: '未选中'
},
{
title: '未选中'
},
{
title: '未选中'
}
]
export const demo4 = [
{
title: '热门场景'
},
{
title: '热门场景'
},
{
title: '热门场景'
},
{
title: '热门场景'
}
]
export const demo5 = [
{
title: '空调'
},
{
title: '冰箱'
},
{
title: '洗衣机'
},
{
title: '热水器'
},
{
title: '电饭煲'
},
{
title: '电烤箱'
},
{
title: '扫地机'
},
{
title: '洗碗机'
},
{
title: '油烟机'
},
{
title: '净水器'
}
]
export const demo6 = [
{
title: '起居',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living_visited@3x.png'
},
{
title: '厨房',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen_visited@3x.png'
},
{
title: '安防',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security_visited@3x.png'
},
{
title: '卫浴',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom_visited@3x.png'
}
]
export const demo7 = [
{
title: '起居',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living_visited@3x.png'
},
{
title: '厨房',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen_visited@3x.png'
},
{
title: '安防',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security_visited@3x.png'
},
{
title: '卫浴',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom_visited@3x.png'
},
{
title: '起居',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living_visited@3x.png'
},
{
title: '厨房',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen_visited@3x.png'
},
{
title: '安防',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security_visited@3x.png'
},
{
title: '卫浴',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom_visited@3x.png'
}
]
export const demo8 = [
{
title: '起居',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living_visited@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_living@3x.png'
},
{
title: '厨房',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen_visited@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_kitchen@3x.png'
},
{
title: '安防',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security_visited@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_security@3x.png'
},
{
title: '卫浴',
icon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom_visited@3x.png',
activeIcon: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/scene/icon_scene_bathroom@3x.png'
}
]
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# 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