|
|
- <template>
- <view class="">
- <view class="tabbar-box"></view>
- <view class="tabbar">
- <view
- :class="{item : true, active : select == index}"
- v-for="(item, index) in list"
- :key="index"
-
- @click="toPath(item, index)">
- <!--v-if="!item.isNotShop || !userShop"-->
-
- <view class="icon">
- <image :src="select == index ?
- item.selectedIconPath :
- item.iconPath" class="icon-image" mode=""></image>
- </view>
- <view class="title">
- {{ $t(item.title) }}
- </view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- import { mapGetters } from 'vuex'
- export default {
- name:"tabbar",
- props : ['select'],
- computed : {
- ...mapGetters(['userShop']),
- },
- data() {
- return {
- list : [
- {
- "selectedIconPath": "/static/image/tabbar/index-a.png",
- "iconPath": "/static/image/tabbar/index.svg",
- "pagePath": "/pages/index/index",
- "title": "tabbar.title.1"
- },
- {
- "selectedIconPath": "/static/image/tabbar/Trading-a.png",
- "iconPath": "/static/image/tabbar/Trading.svg",
- "pagePath": "/pages/index/tradingPlatform",
- "title": "tabbar.title.2"
- },
- {
- "selectedIconPath": "/static/image/tabbar/clearanceService-a.png",
- "iconPath": "/static/image/tabbar/clearanceService.svg",
- "pagePath": "/pages/index/clearanceService",
- "title": "tabbar.title.3"
- },
- {
- "selectedIconPath": "/static/image/tabbar/center-a.png",
- "iconPath": "/static/image/tabbar/center.svg",
- "pagePath": "/pages/index/center2",
- "title": "tabbar.title.4"
- }
- ]
- };
- },
- methods : {
- toPath(item, index){
- if(index == this.select){
- return
- }
- uni.redirectTo({
- url: item.pagePath
- })
- },
- }
- }
- </script>
-
- <style scoped lang="scss">
- .tabbar-box{
- height: 120rpx;
- padding-bottom: env(safe-area-inset-bottom);
- }
- .tabbar{
- position: fixed;
- width: 750rpx;
- background-color: $uni-color;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: row;
- height: 120rpx;
- padding-bottom: env(safe-area-inset-bottom);
- z-index: 99;
- bottom: 0;
- left: 0;
- color: #FFF;
- .item{
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .icon{
- width: 54rpx;
- height: 54rpx;
- .icon-image{
- width: 54rpx;
- height: 54rpx;
- }
- }
- .title{
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- -o-text-overflow: ellipsis;
- font-size: 22rpx;
- line-height: 35rpx;
- }
- }
- }
- .active{
- color: #FFF !important;
-
- }
- </style>
|