zxl
2 天以前 874e9cce3b2f9b6649ab72047d98e4244a345b3c
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
<template>
  <view class="tabbar">
    <view class="tab-item" :class="{ active: active === 'home' }" @click="goHome">
      <uni-icons type="home" :color="active === 'home' ? '#1E88E5' : '#666'" size="36"></uni-icons>
      <text class="label">首页</text>
    </view>
    <view class="tab-item" :class="{ active: active === 'progress' }" @click="goProgress">
      <uni-icons type="list" :color="active === 'progress' ? '#1E88E5' : '#666'" size="36"></uni-icons>
      <text class="label">总进度</text>
    </view>
     <view class="tab-item" :class="{ active: active === 'projects' }" @click="goReport">
      <uni-icons type="list" :color="active === 'projects' ? '#1E88E5' : '#666'" size="36"></uni-icons>
      <text class="label">上报</text>
    </view>
    <view class="tab-item" :class="{ active: active === 'mine' }" @click="goMine">
      <uni-icons type="person" :color="active === 'mine' ? '#1E88E5' : '#666'" size="36"></uni-icons>
      <text class="label">我的</text>
    </view>
  </view>
</template>
 
<script>
 
export default {
  name: 'BottomTabBar',
  props: {
    active: {
      type: String,
      default: 'home'
    }
  },
  methods: {
    goHome() {
      uni.redirectTo({ url: '/pages/index/index', });
    },
    goProgress() {
      uni.redirectTo({ url: '/subpackage/manager/progress', });
    },
    goMine() {
      uni.redirectTo({ url: '/subpackage/user/mine', });
    },
    goReport() {
      uni.redirectTo({ url: '/subpackage/manager/report', });
    }
  }
}
</script>
 
<style scoped>
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100rpx;
  background-color: #ffffff;
  border-top: 1rpx solid #eee;
  box-shadow: 0 -4rpx 10rpx rgba(0, 0, 0, 0.06);
  display: flex;
  z-index: 99;
  padding-bottom: env(safe-area-inset-bottom);
}
 
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 24rpx;
}
 
.tab-item .icon {
  font-size: 36rpx;
  line-height: 40rpx;
  margin-bottom: 6rpx;
}
 
.tab-item.active {
  color: #1E88E5;
  font-weight: 600;
}
</style>