chore(分包): tarBar达到分包前效果

This commit is contained in:
2025-12-30 09:13:29 +08:00
parent 366c4e4cd0
commit 44dd7f30cf
3 changed files with 23 additions and 20 deletions

View File

@@ -6,13 +6,17 @@ import {
} from 'common/js/wx-jssdk.js'; } from 'common/js/wx-jssdk.js';
// 首页路径
export const INDEX_PAGE_URL = '/pages/index/index';
// 当前最新的tabBar.list (参见pages.json 中的tabBar.list 配置) // 当前最新的tabBar.list (参见pages.json 中的tabBar.list 配置)
export const systemTabBarList = [ export const systemTabBarList = [
'/pages/index/index', INDEX_PAGE_URL,
'/pages_goods/category', '/pages_goods/category',
'/pages_tool/contact/contact', '/pages_tool/contact/contact',
'/pages_tool/member/index' '/pages_tool/member/index'
]; ];
/** /**
* 适配子包路径 * 适配子包路径
@@ -86,9 +90,8 @@ export default {
for (let i = 0; i < systemTabBarList.length; i++) { for (let i = 0; i < systemTabBarList.length; i++) {
const tabBarUrl = systemTabBarList[i]; const tabBarUrl = systemTabBarList[i];
if (url.indexOf(tabBarUrl) == 0) { if (url.indexOf(tabBarUrl) == 0) {
uni.switchTab({ // 首页特殊处理采用switchTab, 其他页面采用redirectTo, 不能返回,不能退回
url (tabBarUrl == INDEX_PAGE_URL ? uni.switchTab : uni.redirectTo)({url});
});
return; return;
} }
} }
@@ -115,12 +118,11 @@ export default {
break; break;
default: default:
// 保留当前页面,跳转到应用内的某个页面 // 保留当前页面,跳转到应用内的某个页面
console.log('保留当前页面,跳转到应用内的某个页面', url);
uni.navigateTo({ uni.navigateTo({
url url
}); });
} }
console.log('无任何处理', url);
}, },
/** /**
* 图片路径转换 * 图片路径转换

View File

@@ -1,12 +1,17 @@
{ {
"pages": [ "pages": [
// pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
// "navigationStyle": "custom", // "navigationStyle": "custom",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
},
{
"path": "pages/empty/index",
"style": {
"enablePullDownRefresh": true
}
} }
], ],
"subPackages": [ "subPackages": [
@@ -932,15 +937,7 @@
"text": "" "text": ""
}, },
{ {
"pagePath": "pages_goods/category", "pagePath": "pages/empty/index",
"text": ""
},
{
"pagePath": "pages_tool/contact/contact",
"text": ""
},
{
"pagePath": "pages_tool/member/index",
"text": "" "text": ""
} }
] ]

4
pages/empty/index.vue Normal file
View File

@@ -0,0 +1,4 @@
<template>
<page-meta :page-style="themeColor"></page-meta>
<view/>
</template>