feat: 完成分类页开发
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { NAV_INNER_PX } from '../../utils/navMetrics';
|
||||
|
||||
const HOME_TAB_URL = '/pages/home/home';
|
||||
const HOME_ROUTE = 'pages/home/home';
|
||||
|
||||
const TAB_BAR_ROUTES = new Set([
|
||||
'pages/home/home',
|
||||
HOME_ROUTE,
|
||||
'pages/category/category',
|
||||
'pages/age/age',
|
||||
'pages/favorites/favorites',
|
||||
'pages/profile/profile',
|
||||
@@ -17,7 +20,9 @@ Component({
|
||||
data: {
|
||||
statusBarHeight: 0,
|
||||
navBlockHeight: 0,
|
||||
leftActionType: 'none',
|
||||
leftActionType: 'none' as 'none' | 'back' | 'home' | 'brand',
|
||||
/** 仅首页(Tab 根页)在 logo 旁展示「涂鸦丫」;其余主 Tab 只展示 logo */
|
||||
showBrandName: false,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
@@ -40,15 +45,19 @@ Component({
|
||||
const currentRoute = pages[pages.length - 1]?.route || '';
|
||||
const isTabBarPage = TAB_BAR_ROUTES.has(currentRoute);
|
||||
|
||||
let leftActionType: 'none' | 'back' | 'home' = 'none';
|
||||
let leftActionType: 'none' | 'back' | 'home' | 'brand' = 'none';
|
||||
const showBrandName = currentRoute === HOME_ROUTE;
|
||||
|
||||
if (pages.length > 1) {
|
||||
leftActionType = 'back';
|
||||
} else if (!isTabBarPage) {
|
||||
leftActionType = 'home';
|
||||
} else {
|
||||
// 五个主 Tab 根页:仅展示品牌区(左 logo;首页另见 showBrandName)
|
||||
leftActionType = 'brand';
|
||||
}
|
||||
|
||||
this.setData({ leftActionType });
|
||||
this.setData({ leftActionType, showBrandName });
|
||||
},
|
||||
|
||||
handleLeftAction() {
|
||||
|
||||
Reference in New Issue
Block a user