tabBar.vue
1.11 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
56
57
58
59
60
61
62
63
64
65
<template>
<view class="tab-bar">
<u-tabbar
:value="currentPagePath"
activeColor="#cf000d"
zIndex="100"
:fixed="true"
:placeholder="true"
:safeAreaInsetBottom="true"
>
<u-tabbar-item
v-for="(item,index) in tabBarList"
:key="index"
:text="item.text"
:icon="item.pagePath === currentPagePath ? item.selectedIconPath : item.iconPath"
:name="item.pagePath"
@click="click_page(item.pagePath)"
/>
</u-tabbar>
</view>
</template>
<script>
import {
mapGetters
} from 'vuex'
export default {
name: 'tabBar',
props: {
currentPagePath: String,
},
data() {
return {}
},
computed: {
...mapGetters([
'tabBarList'
])
},
created() {
console.log('tabBarList', this.tabBarList)
},
methods: {
click_page(arg) {
let page = '/' + arg
console.log(page)
uni.switchTab({
url: page
})
}
}
}
</script>
<style scoped lang="scss">
.tab-bar {
::v-deep {
.u-icon__img {
height: 28px !important;
width: 28px !important;
}
}
}
</style>