feat(tabbar): 添加国内资讯标签页并调整标签栏顺序
- 新增国内资讯标签页,包含激活和非激活状态图标 - 调整标签栏顺序,将我的页面与国内资讯位置互换 - 优化标签栏条件渲染逻辑,使用v-else简化代码
This commit is contained in:
parent
14fa72f32b
commit
77029700ed
Binary file not shown.
|
After Width: | Height: | Size: 674 B |
Binary file not shown.
|
After Width: | Height: | Size: 555 B |
|
|
@ -2,13 +2,13 @@
|
|||
<view class="tabbar">
|
||||
<view class="tabbar_item" @click="tabChange(0)">
|
||||
<image
|
||||
v-if="tabIndex == 1"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
|
||||
v-if="tabIndex == 0"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
|
||||
class="tabbar_img"
|
||||
/>
|
||||
<image
|
||||
v-if="tabIndex == 0"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
|
||||
v-else
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
|
||||
class="tabbar_img"
|
||||
/>
|
||||
<text
|
||||
|
|
@ -18,18 +18,31 @@
|
|||
>
|
||||
</view>
|
||||
|
||||
<view class="tabbar_item" @click="tabChange(1)">
|
||||
<view class="tabbar_item" @click="tabChange(2)">
|
||||
<image
|
||||
v-if="tabIndex == 0"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
|
||||
v-if="tabIndex == 2"
|
||||
src="../../assets/activeCaixun.png"
|
||||
class="tabbar_img"
|
||||
/>
|
||||
<image v-else src="../../assets/caixun.png" class="tabbar_img" />
|
||||
<text
|
||||
class="tabbar_title"
|
||||
:style="{ color: tabIndex == 2 ? '#D13E3C' : '#757A80' }"
|
||||
>国内资讯</text
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="tabbar_item" @click="tabChange(1)">
|
||||
<image
|
||||
v-if="tabIndex == 1"
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
|
||||
class="tabbar_img"
|
||||
/>
|
||||
|
||||
<image
|
||||
v-else
|
||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
|
||||
class="tabbar_img"
|
||||
/>
|
||||
<text
|
||||
class="tabbar_title"
|
||||
:style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }"
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
<template>
|
||||
<view class="root" :style="{ backgroundColor: tabIndex == 4 ? '#f6f6f6' : '#ffffff' }">
|
||||
<view
|
||||
class="root"
|
||||
:style="{ backgroundColor: tabIndex == 4 ? '#f6f6f6' : '#ffffff' }"
|
||||
>
|
||||
<!-- 首页 start -->
|
||||
<Index v-if="menuStateConfig.home.active" :columnState="menuStateConfig.home" :colList="homeColList" @onChange="handleMenuChange"></Index>
|
||||
<Index
|
||||
v-if="menuStateConfig.home.active"
|
||||
:columnState="menuStateConfig.home"
|
||||
:colList="homeColList"
|
||||
@onChange="handleMenuChange"
|
||||
></Index>
|
||||
<!-- 首页 end -->
|
||||
<!-- vip start -->
|
||||
<vip v-if="menuStateConfig.vip.active" :columnState="menuStateConfig.vip" :colList="vipColList" @onChange="handleMenuChange"></vip>
|
||||
<vip
|
||||
v-if="menuStateConfig.vip.active"
|
||||
:columnState="menuStateConfig.vip"
|
||||
:colList="vipColList"
|
||||
@onChange="handleMenuChange"
|
||||
></vip>
|
||||
<!-- vip end -->
|
||||
<!-- 我的 start -->
|
||||
<mine v-if="menuStateConfig.mine.active"></mine>
|
||||
|
|
@ -19,14 +32,24 @@
|
|||
@change="handleMenuChange($event, 'tabbar')"
|
||||
z-index="600"
|
||||
>
|
||||
<u-tabbar-item :text="item.title" v-for="(item, index) in menuList" :key="index">
|
||||
<u-tabbar-item
|
||||
:text="item.title"
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
>
|
||||
<template #active-icon>
|
||||
<view v-if="index == 0" style="height: 40rpx"></view>
|
||||
<image :src="item.iconc" :class="[index == 0 ? 'vipcass_c' : 'menu_icon']"></image>
|
||||
<image
|
||||
:src="item.iconc"
|
||||
:class="[index == 0 ? 'vipcass_c' : 'menu_icon']"
|
||||
></image>
|
||||
</template>
|
||||
<template #inactive-icon>
|
||||
<view v-if="index == 0" style="height: 40rpx"></view>
|
||||
<image :src="item.icon" :class="[index == 0 ? 'vipcass' : 'menu_icon']"></image>
|
||||
<image
|
||||
:src="item.icon"
|
||||
:class="[index == 0 ? 'vipcass' : 'menu_icon']"
|
||||
></image>
|
||||
</template>
|
||||
</u-tabbar-item>
|
||||
</u-tabbar>
|
||||
|
|
@ -135,11 +158,17 @@ const setMenuStateConfig = (option: any) => {
|
|||
const __menuStateConfig = Session.get("menuStateConfig");
|
||||
|
||||
if (__menuStateConfig) {
|
||||
const activeObject: any = Object.values(__menuStateConfig).find((item: any) => item.active);
|
||||
const activeObject: any = Object.values(__menuStateConfig).find(
|
||||
(item: any) => item.active
|
||||
);
|
||||
const activeId = activeObject ? activeObject.id : 0;
|
||||
tabIndex.value = activeId;
|
||||
menuStateConfig.value = __menuStateConfig;
|
||||
} else if (option?.tabIndex || option?.columnIndex || option?.subColumnIndex) {
|
||||
} else if (
|
||||
option?.tabIndex ||
|
||||
option?.columnIndex ||
|
||||
option?.subColumnIndex
|
||||
) {
|
||||
const index = Number(option?.tabIndex) || 0;
|
||||
const columnIndex = Number(option?.columnIndex) || 0;
|
||||
const subColumnIndex = Number(option?.subColumnIndex) || 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue