|
@@ -1,14 +1,14 @@
|
|
<template>
|
|
<template>
|
|
- <view class="ezy-custom-tabbar">
|
|
|
|
- <view class="tabbar-item-box">
|
|
|
|
- <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)"
|
|
|
|
- :style="{ backgroundImage: 'url(' + (currentTab == index ? item.activePath : item.iconPath) + ')' }">
|
|
|
|
- </view>
|
|
|
|
|
|
+ <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">{{item.text}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+ import {getStaticUrl} from '@/utils/common.js';
|
|
import {
|
|
import {
|
|
useTabBarHistory
|
|
useTabBarHistory
|
|
} from '@/utils/emitEvents.js';
|
|
} from '@/utils/emitEvents.js';
|
|
@@ -17,19 +17,22 @@
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
tabList: [{
|
|
tabList: [{
|
|
- iconPath: 'static/images/tabbar/unselect/plan-sj.png',
|
|
|
|
- activePath: 'static/images/tabbar/select/plan-sj.png',
|
|
|
|
- path: `/pages/study/index`
|
|
|
|
|
|
+ text: '首页',
|
|
|
|
+ path: `/pages/study/index`,
|
|
|
|
+ iconPath: getStaticUrl('static/images/tabbar/unselect/index-icon.png'),
|
|
|
|
+ activePath: getStaticUrl('static/images/tabbar/select/index-icon.png'),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- iconPath: 'static/images/tabbar/unselect/partner-sj.png',
|
|
|
|
- activePath: 'static/images/tabbar/select/partner-sj.png',
|
|
|
|
- path: '/pages/game/index'
|
|
|
|
|
|
+ text: '家政',
|
|
|
|
+ path: '/pages/game/index',
|
|
|
|
+ iconPath: getStaticUrl('static/images/tabbar/unselect/jz-icon.png'),
|
|
|
|
+ activePath: getStaticUrl('static/images/tabbar/select/jz-icon.png'),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- iconPath: 'static/images/tabbar/unselect/my-sj.png',
|
|
|
|
- activePath: 'static/images/tabbar/select/my-sj.png',
|
|
|
|
- path: `/pages/my/index`
|
|
|
|
|
|
+ text: '我的',
|
|
|
|
+ path: `/pages/my/index`,
|
|
|
|
+ iconPath: getStaticUrl('static/images/tabbar/unselect/my-icon.png'),
|
|
|
|
+ activePath: getStaticUrl('static/images/tabbar/select/my-icon.png'),
|
|
},
|
|
},
|
|
],
|
|
],
|
|
currentTab: 0,
|
|
currentTab: 0,
|
|
@@ -54,20 +57,3 @@
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
|
|
-<style scoped>
|
|
|
|
- .custom-tabbar {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: space-around;
|
|
|
|
- align-items: center;
|
|
|
|
- /* 其他样式 */
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .tab-item {
|
|
|
|
- flex: 1;
|
|
|
|
- /* 样式 */
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .tab-icon {
|
|
|
|
- /* 图标样式 */
|
|
|
|
- }
|
|
|
|
-</style>
|
|
|