123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <view class="phone-custom-tabbar">
- <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)">
- <icon class="tabbar-item-icon" :style="{ backgroundImage: 'url(' + (currentTab == index ? item.activePath : item.iconPath) + ')' }"></icon>
- <text class="tabbar-item-text" :class="{active: currentTab == index}">{{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/admin/ShouYe/shouye`,
- iconPath: getStaticUrl('static/images/tabbar/unselect/index-icon.png'),
- activePath: getStaticUrl('static/images/tabbar/select/index-icon.png'),
- },
- {
- text: '家政',
- path: '/pages/admin/Jiazheng/index',
- iconPath: getStaticUrl('static/images/tabbar/unselect/jz-icon.png'),
- activePath: getStaticUrl('static/images/tabbar/select/jz-icon.png'),
- },
- {
- text: '我的',
- path: `/pages/admin/my/index`,
- iconPath: getStaticUrl('static/images/tabbar/unselect/my-icon.png'),
- activePath: getStaticUrl('static/images/tabbar/select/my-icon.png'),
- },
- ],
- };
- },
- methods: {
- switchTab(path, index) {
- uni.reLaunch({
- url: path
- });
- },
- },
- }
- </script>
- <style scoped>
- .tabbar-item-box {
- display: flex;
- justify-content: space-around;
- align-items: center;
- height: 60px;
- line-height: 60px;
- /* 其他样式 */
- }
- .tab-item {
- flex: 1;
- /* 样式 */
- }
- .tab-icon {
- /* 图标样式 */
- }
- </style>
|