123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <view>
- <!-- 用户端 -->
- <view v-if="isShow">
- <u-tabbar :value="currentTab" activeColor="#2D73F0" inactiveColor="#333" :border="true">
- <u-tabbar-item
- v-for="item in clientList"
- :key="item.name"
- :text="item.text"
- :name="item.name"
- @click="handTab(item)"
- >
- <image class="bar_img" slot="active-icon" :src="item.selectedIconPath" />
- <image class="bar_img" slot="inactive-icon" :src="item.iconPath" />
- </u-tabbar-item>
- </u-tabbar>
- </view>
- <!-- 商家端 -->
- <view v-if="!isShow">
- <u-tabbar :value="currentTab" activeColor="#2D73F0" inactiveColor="#333" :border="true">
- <u-tabbar-item
- v-for="item in merchantList"
- :key="item.name"
- :text="item.text"
- :name="item.name"
- @click="handTab(item)"
- >
- <image class="bar_img" slot="active-icon" :src="item.selectedIconPath" />
- <image class="bar_img" slot="inactive-icon" :src="item.iconPath" />
- </u-tabbar-item>
- </u-tabbar>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'TabBar',
- props: {
- currentTab: {
- type: String,
- default: 'clientHome',
- },
- },
- data() {
- return {
- isShow: true,
- clientList: [
- {
- text: '首页',
- name: 'clientHome',
- pagePath: '/pages/client/tabBar/home/index',
- iconPath: '/static/images/home.png',
- selectedIconPath: '/static/images/home-select.png',
- },
- // {
- // text: '社区',
- // name: 'clientCommunity',
- // pagePath: '/pages/client/tabBar/community/index',
- // iconPath: '/static/images/community.png',
- // selectedIconPath: '/static/images/community-select.png',
- // },
- {
- text: '消息',
- name: 'clientMessage',
- pagePath: '/pages/client/tabBar/message/index',
- iconPath: '/static/images/message.png',
- selectedIconPath: '/static/images/message-select.png',
- },
- {
- text: '我的',
- name: 'clientMine',
- pagePath: 'pages/client/tabBar/mine/index',
- iconPath: '/static/images/mine.png',
- selectedIconPath: '/static/images/mine-select.png',
- },
- ],
- merchantList: [
- {
- text: '订单',
- name: 'merchantOrder',
- pagePath: 'pages/merchant/tabBar/order/index',
- iconPath: '/static/images/home.png',
- selectedIconPath: '/static/images/home-select.png',
- },
- {
- text: '消息',
- name: 'merchantMessage',
- pagePath: 'pages/merchant/tabBar/message/index',
- iconPath: '/static/images/community.png',
- selectedIconPath: '/static/images/community-select.png',
- },
- // {
- // text: '推广',
- // name: 'merchantExtend',
- // pagePath: 'pages/merchant/tabBar/extend/index',
- // iconPath: '/static/images/community.png',
- // selectedIconPath: '/static/images/community-select.png',
- // },
- {
- text: '店铺',
- name: 'merchantStore',
- pagePath: 'pages/merchant/tabBar/store/index',
- iconPath: '/static/images/message.png',
- selectedIconPath: '/static/images/message-select.png',
- },
- {
- text: '我的',
- name: 'merchantMine',
- pagePath: 'pages/merchant/tabBar/mine/index',
- iconPath: '/static/images/mine.png',
- selectedIconPath: '/static/images/mine-select.png',
- },
- ],
- };
- },
- mounted() {
- this.isShow = uni.getStorageSync('tabbar_type');
- // if(!this.isShow){
- // this.isShow = true
- // }
- },
- watch: {
- isShow(newValue) {
- console.log('@@@isShownewValue', newValue);
- },
- },
- methods: {
- handTab(row) {
- if (this.isShow) {
- uni.switchTab({
- url: row.pagePath,
- });
- } else {
- uni.redirectTo({
- url: row.pagePath,
- });
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .bar_img {
- width: 54rpx;
- height: 54rpx;
- }
- ::deep .u-tabbar {
- border-top: 2rpx solid #dadbde;
- }
- </style>
|