| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <template>
- <view class="phone-client-tabbar">
- <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)">
- <!-- <icon :style="{ backgroundImage: 'url(' + (currentTab == index ? item.activePath : item.iconPath) + ')' }"></icon> -->
- <image class="tabbar-item-icon" :src="currentTab === index ? item.activePath : item.iconPath" mode="aspectFit"></image>
- <text class="tabbar-item-text">{{item.text}}</text>
- </view>
- </view>
- </template>
- <script>
- import {getStaticUrl} from '@/utils/common.js';
- import {
- useTabBarHistory
- } from '@/utils/emitEvents.js';
- import cacheManager from "@/utils/cacheManager.js";
- export default {
- props: {
- currentTab: {
- type: Number,
- }
- },
- data() {
- return {
- tabList: [{
- text: '首页',
- path: `/pages/kehu/shouYe/shouye`,
- iconPath: '/static/images/tabbar/unselect/client-jz-icon.png',
- activePath:'/static/images/tabbar/select/client-jz-icon.png',
- },
- {
- text: '我的',
- path: `/pages/kehu/my/my`,
- iconPath: '/static/images/tabbar/unselect/client-my-icon.png',
- activePath: '/static/images/tabbar/select/client-my-icon.png',
- },
- ],
- };
- },
- methods: {
- switchTab(path, index) {
- if (index == this.currentTab) {
- // 同页面不刷新
- return;
- }
- uni.redirectTo({url: path});
- },
- },
- }
- </script>
|