uniapp分包加载

pages.json:

{
    "easycom": {
        "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
    },
    "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path": "pages/home/home",
            "style": {
                "navigationBarTitleText": "测试市十四",
                "navigationStyle": "custom"
            }
        },{
            "path": "pages/my/my",
            "style": {
                "navigationBarTitleText": "个人中心"
            }
        }
    ],
    "subPackages":[ {
        "root":"packageFeatures",
        "name":"packageFeatures",
        "pages":[
        {
            "path": "chronicDisease/list",
            "style": {
                "navigationBarTitleText": "***",
                "enablePullDownRefresh": true
            }
        }]
    }],
    "preloadRule": {  //加载规则 当渲染pages/home/home时加载子包
        "pages/home/home": {
            "network": "all",
            "packages": ["packageFeatures"]
        }
    },
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "测试室",
        "navigationBarBackgroundColor": "#F8F8F8",
        "backgroundColor": "#F8F8F8"
    },
    "tabBar": {
        "color": "#7A7E83",
        "selectedColor": "#1296db",
        "borderStyle": "black",
        "backgroundColor": "#ffffff",
        "list": [{
            "pagePath": "pages/home/home",
            "iconPath": "static/tabbar/icon_home.png",
            "selectedIconPath": "static/tabbar/icon_home_HL.png",
            "text": "首页"
        }, {
            "pagePath": "pages/my/my",
            "iconPath": "static/tabbar/icon_my.png",
            "selectedIconPath": "static/tabbar/icon_my_HL.png",
            "text": "我的"
        }]
    }
}

目录:

uniapp分包加载_第1张图片

 

 

重要的一步:

uniapp分包加载_第2张图片

 

你可能感兴趣的:(uniapp)