Blame view

member-miniapp/components/lf-tabbar.vue 2.7 KB
5c34676a   “wangming”   对会员端进行了设计
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
  <template>
    <view class="tabbar-wrap">
      <view class="tabbar-panel">
        <view
          v-for="item in tabs"
          :key="item.key"
          class="tabbar-item"
          :class="{ active: current === item.key }"
          @tap="go(item)"
        >
          <view class="icon-shell">
            <image class="icon-img" :src="current === item.key ? item.activeIcon : item.icon" mode="aspectFit" />
          </view>
          <text class="tabbar-label">{{ item.label }}</text>
        </view>
      </view>
    </view>
  </template>
  
  <script>
  export default {
    name: 'LfTabbar',
    props: {
      current: {
        type: String,
        default: 'home'
      }
    },
    data() {
      return {
        tabs: [
          {
            key: 'home',
            label: '首页',
            path: '/pages/home/home',
            icon: '/static/images/tab-home.png',
            activeIcon: '/static/images/tab-home-active.png'
          },
          {
            key: 'booking',
            label: '预约',
            path: '/pages/booking/booking',
            icon: '/static/images/tab-booking.png',
            activeIcon: '/static/images/tab-booking-active.png'
          },
          {
            key: 'mall',
            label: '商城',
            path: '/packageMall/main/main',
            icon: '/static/images/tab-mall.png',
            activeIcon: '/static/images/tab-mall-active.png'
          },
          {
            key: 'profile',
            label: '我的',
            path: '/pages/profile/profile',
            icon: '/static/images/tab-profile.png',
            activeIcon: '/static/images/tab-profile-active.png'
          }
        ]
      }
    },
    methods: {
      go(item) {
        if (item.key === this.current) {
          return
        }
        uni.redirectTo({
          url: item.path
        })
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  @import '@/styles/mixins.scss';
  
  .tabbar-wrap {
    position: fixed;
    left: 24rpx;
    right: 24rpx;
    bottom: calc(20rpx + env(safe-area-inset-bottom));
    z-index: 30;
  }
  
  .tabbar-panel {
    @include glass-panel(0.96);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 118rpx;
    padding: 12rpx 12rpx 10rpx;
    border-radius: 999rpx;
    box-shadow: $shadow-strong;
  }
  
  .tabbar-item {
    width: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8rpx 0;
    border-radius: 999rpx;
  }
  
  .icon-shell {
    width: 78rpx;
    height: 78rpx;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .icon-img {
    width: 60rpx;
    height: 60rpx;
  }
  
  .tabbar-label {
    margin-top: 4rpx;
    font-size: 22rpx;
    color: $text-tertiary;
    font-weight: 500;
  }
  
  .tabbar-item.active {
    background: rgba(255, 255, 255, 0.72);
  
    .tabbar-label {
      color: $brand-primary-deep;
      font-weight: 700;
    }
  }
  </style>