1.创建项目+创建
2.在pages.jison修改
"subPackages": [
{
"name": "login",
"root": "pages/login",
"pages": [
{
"path": "login",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
},
{
"name": "home",
"root": "pages/home",
"pages": [
{
"path": "home",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
},
{
"name": "lest",
"root": "pages/lest",
"pages": [
{
"path": "lest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
}
],
"preloadRule": {
"pages/home/home": {
"network": "all",
"packages": ["login", "home", "lest"]
}
},
运行到小程序就完成分包了
!!!注意,在分包时pages删除subPackages配置的地址,不然要报错哦~