index.vue
1.4 KB
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
<template>
<van-tabbar active-color="#2C66F7"
inactive-color="#999999"
route
safe-area-inset-bottom>
<van-tabbar-item v-for="(item, index) in tabList"
:key="index"
replace
:to="item.to">
<span>{{ item.title }}</span>
<template #icon="props">
<img class="tab-icon" :src="props.active ? item.activeIcon : item.inactiveIcon" />
</template>
</van-tabbar-item>
</van-tabbar>
</template>
<script>
export default {
name: "TabBar",
data() {
const baseUrl = "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/";
return {
tabList: [
{
title: "团队工作台",
to: "/teamWork/teamList",
activeIcon: baseUrl + "tab-home-active.png",
inactiveIcon: baseUrl + "tab-home.png",
},
{
title: "业绩概览",
to: { path: "/performance/index" },
activeIcon: baseUrl + "tab-view-active.png",
inactiveIcon: baseUrl + "tab-view.png",
},
{
title: "我的任务",
to: "/mine/tasks",
activeIcon: baseUrl + "tab-mine-active.png",
inactiveIcon: baseUrl + "tab-mine.png",
},
],
};
},
};
</script>
<style lang="scss" scoped>
/* van-tabbar-item 默认图标大小比较小,我们稍微调整大一点点确保和设计图相似 */
:deep(.van-tabbar-item__icon img) {
height: 20px;
width: 20px;
}
</style>