uniapp微信小程序分包,小程序分包

前言,都知道我是一个后端开发、所以今天来写一下uniapp。

起因是美工给我的切图太大,微信小程序不让了,在网上找了一大堆分包的文章,我心思我照着写的啊,怎么就一直报错呢?
错误原因 tabBar的页面被我放在分包了(咋就没人告诉一下呢?)

tabBar的页面要放在主包中!tabBar的页面要放在主包中!tabBar的页面要放在主包中!(重要的事情说3遍)

pages.json

java 复制代码
{
	"easycom": {
		"autoscan": true,
		"^u-(.*)": "@/vk-uview-ui/components/u-$1/u-$1.vue"
	},
	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "首页",
				"enablePullDownRefresh": true, //是否启用刷新
				"app-plus": {
					"titleNView": false
				}
			}
		},
		{
			"path": "pages/login/index",
			"style": {
				"navigationBarTitleText": "登录"
			}
		},
		{
			"path": "pages/mine/work",
			"style": {
				"navigationBarTitleText": "订单"
			}
		},
		{
			"path": "pages/mine/index",
			"style": {
				"navigationBarTitleText": "我的"
			}
		},
		{
			"path": "pages/cpzx/index",
			"style": {
				"navigationBarTitleText": "商城",
				"enablePullDownRefresh": true //是否启用刷新
			}
		}
	],
	/**主资源过大 分包处理*/
	"subPackages": [{
		"root": "pagesA",
		"pages": [{
				"path": "test/test",
				"style": {
					"navigationBarTitleText": "test"
				}
			},
			{
				"path": "fwpj/index",
				"style": {
					"navigationBarTitleText": "服务评价"
				}
			},
			{
				"path": "ywzx/index",
				"style": {
					"navigationBarTitleText": "在线客服"
				}
			},
			{
				"path": "pay/index",
				"style": {
					"navigationBarTitleText": "缴费"
				}
			},
			{
				"path": "mine/about",
				"style": {
					"navigationBarTitleText": "关于我们"
				}
			},
			{
				"path": "webview/index",
				"style": {
					"navigationBarTitleText": ""
				}
			},
			{
				"path": "detil/index",
				"style": {
					"navigationBarTitleText": ""
				}
			}
		]
	}],
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "uni-app",
		"navigationBarBackgroundColor": "#fff",
		"backgroundColor": "#fff",
		"mp-alipay": {
			"allowsBounceVertical": "NO"
		}
	},
	"tabBar": {
		"color": "#a2a6b0",
		"selectedColor": "#070002",
		"borderStyle": "black",
		"backgroundColor": "#FFFFFF",
		"list": [{
				"pagePath": "pages/index/index",
				"iconPath": "static/images/tabbar/nav-1-1.png",
				"selectedIconPath": "static/images/tabbar/nav-1.png",
				"text": "首页"
			},
			{
				"pagePath": "pages/cpzx/index",
				"iconPath": "static/images/tabbar/nav-2-1.png",
				"selectedIconPath": "static/images/tabbar/nav-2.png",
				"text": "商城"
			},
			{
				"pagePath": "pages/mine/work",
				"iconPath": "static/images/tabbar/nav-3-1.png",
				"selectedIconPath": "static/images/tabbar/nav-3.png",
				"text": "订单"
			},
			{
				"pagePath": "pages/mine/index",
				"iconPath": "static/images/tabbar/nav-4-1.png",
				"selectedIconPath": "static/images/tabbar/nav-4.png",
				"text": "我的"
			}
		]
	}
}

目录结构

相关推荐
马哥python说13 小时前
我用DeepSeek Harness快速上线了一个情侣小程序
微信小程序·小程序·云开发
Jackzhang13 小时前
[端与游戏开发手记] 小程序第一次调接口,卡在域名白名单的那半天
微信小程序
djxzyr17 小时前
微信小程序传感器实战:罗盘、加速计、陀螺仪与加速度实时波形
微信小程序·小程序
码间留白2 天前
AI 给的两个方案都被我否了:把 startIcon 与启动遮罩做成同一张图,鸿蒙 APP 冷启动零白屏
性能优化·uni-app·ai编程·harmonyos
anyup2 天前
自带 uni-app x 页面级能力,uView Pro X 8 个开箱即用的工具函数
前端·vue.js·uni-app
陈拉斯3 天前
无后端的人格测试小程序:当「数据不出设备」变成架构约束,我学到了什么
微信小程序
李纲明3 天前
微信小程序开了 Skyline 后样式全乱、滚动对不上甚至部分组件不能用?Skyline 怎么接才稳
javascript·微信小程序·小程序·devdiy
李纲明3 天前
微信小程序等位大桌被小桌占掉或过号回来就闹:先核桌型分队与过号容忍次数,再查门口屏与推送同源
微信小程序·devdiy·等位排队·桌型分队·过号重排·门口屏·推送同源
李纲明3 天前
微信小程序团课临开课才取消或空位没人补:先核取消时限与自动释放,再查候补确认与预扣回滚
微信小程序·devdiy·团课预约·取消时限·空位释放·候补确认·预扣回滚
用户034187671384 天前
用秒哒做了个拍照识餐小程序,上线两周踩的 4 个坑
微信小程序