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
| <template>
| <view class="tabBar">
| <image class="image" :src="'https://ossacmall.bluedeer.com.cn/app/static/images/tabbar_bg'+tabId+'_2.png'"></image>
| <view class="tabBar_itemBox">
| <navigator class="tabBar_item" v-for="tabBarItem,tabBarIndex in tabBarArr" :key="tabBarItem.id"
| :open-type="tabBarItem.isTab?'switchTab':'redirectTo'" hover-class="none" :url="tabBarItem.url" @click="handleTabClick(tabBarItem)"></navigator>
| </view>
| </view>
| </template>
|
| <script>
| export default {
| props: {
| tabId: {
| type: Number,
| default: 1,
| }
| },
| data() {
| return {
| tabBarArr: [{
| 'id': 'tabBar1',
| 'name':'首页',
| 'url': '/pages/index/index',
| 'isTab':true
| },
| {
| 'id': 'tabBar2',
| 'name':'分类',
| 'url': '/pages/goods_cate/goods_cate',
| 'isTab':true
| },
| {
| 'id': 'tabBar3',
| 'name':'购物车',
| 'url': '/pages/order_addcart/order_addcart',
| 'isTab':false
| },
| {
| 'id': 'tabBar4',
| 'name':'我的',
| 'url': '/pages/user/index',
| 'isTab':true
| }
| ]
| }
| },
| methods: {
| handleTabClick(tabItem) {
| if(tabItem.id=='tabBar2'){
| this.$store.commit('updateSwitchParams', {
| switchParams: ''
| });
| }
| if(tabItem.id=='tabBar1'){
| let pages = getCurrentPages(),
| prevPage = pages[pages.length - 2];
| uni.$emit('returnEvent', {
| name: 'tabBar'
| });
| }
|
| this.addTrack('yy_tabClick',{
| buttonName_var:tabItem.name
| });
| }
| }
| }
| </script>
|
| <style lang="scss" scoped>
| .tabBar {
| position: fixed;
| bottom: 0;
| left: 0;
| right: 0;
| z-index: 9998;
|
| .image {
| display: block;
| width: 750rpx;
| height: 218rpx;
| }
|
| .tabBar_itemBox {
| width: 100%;
| height: 218rpx;
| display: flex;
| position: absolute;
| left: 0;
| bottom: 0;
| }
|
| .tabBar_item {
| width: 25%;
| height: 100%;
| }
| }
| </style>
|
|