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": "我的"
			}
		]
	}
}

目录结构

相关推荐
tcdos16 小时前
不止扫码 — 微信生态深度融合(登录 + 支付 + 消息)
后端·微信小程序
小徐_23331 天前
Wot UI 2.2.0 发布:Button 新增 subtle,VideoPreview 预览体验继续增强
前端·微信小程序·uni-app
宸翰2 天前
解决 uni-app App 端 vue-i18n 占位符丢失:封装跨端可用的 tf 格式化方法
前端·vue.js·uni-app
时光足迹3 天前
uni-app 视频通话实战:康复师与患者视频问诊的 6 个致命 Bug 与解决方案
android·ios·uni-app
时光足迹3 天前
腾讯云 TRTC UniApp SDK 从入门到上线
前端·vue.js·uni-app
时光足迹3 天前
uni-app 里把加密视频嵌入页面播放?我分析了 4 种方案,只有 1 种接近完美
前端·vue.js·uni-app
时光足迹3 天前
JPush UniApp UTS 插件完全参考手册:API、事件与厂商通道一网打尽
vue.js·ios·uni-app
时光足迹3 天前
极光推送全攻略(下):uni-app 代码实现与 iOS 排查实战
vue.js·ios·uni-app
时光足迹3 天前
极光推送全攻略(上):被iOS证书折磨了三天,我写了一份前端也能看懂的避坑指南
前端·ios·uni-app
蜗牛前端4 天前
codex 全流程开发上线的高颜值礼簿小程序
前端·微信小程序