uniapp分包

pages.json:

{
    "pages": [
        {
            "path": "pages/index/index",
            "name":"index",
            "style": {
                "navigationStyle": "custom",
                "navigationBarTitleText": "首页",
                "app-plus": {
                    "bounce": "vertical",
                    "titleNView": {
                        "autoBackButton":"true"
                    }
                }
            }
        },
        {
            "path": "pages/login/login",
            "name":"login",
            "style": {
                "navigationBarTitleText": "登录"
            }
        },
        {
            "path": "pages/index/liveWindow",
            "name":"liveWindow",
            "style": {
                "navigationStyle": "custom",
                "navigationBarTitleText": "直播弹窗",
                "backgroundColor": "#000000",
                "app-plus": {
                    "bounce": "vertical",
                    "background":"#000000",
                    "titleNView": {
                        "autoBackButton":"true"
                    }
                }
            }
        }
    ],
    "subPackages" : [
        {
            "root" : "packageA",
            "pages" : [
                {
                    "path": "pages/livePlayer",
                    "aliasPath":"/:id",
                    "name":"livePlayer",
                    "style": {
                        "navigationStyle": "custom",
                        "navigationBarTitleText": "直播",
                        "backgroundColor": "#000000",
                        "app-plus": {
                            "bounce": "vertical",
                            "background":"#000000",
                            "titleNView": {
                                "autoBackButton":"true"
                            }
                        }
                    }
                },
                {
                    "path": "pages/liveGoodsList",
                    "name":"liveGoodsList",
                    "style": {
                        "navigationStyle": "custom",
                        "navigationBarTitleText": "直播商品",
                        "backgroundColor": "#000000",
                        "app-plus": {
                            "bounce": "vertical",
                            "background":"#000000",
                            "titleNView": {
                                "autoBackButton":"true"
                            }
                        }
                    }
                },
                {
                    "path": "pages/liveBusiness",
                    "name":"liveBusiness",
                    "style": {
                        "navigationBarTitleText": "我要直播"
                    }
                },
                {
                    "path": "pages/livePusher",
                    "name":"livePusher",
                    "style": {
                        "navigationStyle": "custom",
                        "navigationBarTitleText": "商家直播",
                        "backgroundColor": "#000000",
                        "app-plus": {
                            "bounce": "vertical",
                            "background":"#000000",
                            "titleNView": {
                                "autoBackButton":"true"
                            }
                        }
                    }
                }
            ]
        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "网",
        "navigationBarBackgroundColor": "#F7F5F6",
        "backgroundColor": "#F7F5F6",
        "app-plus": {
            "titleNView": {  
                "backgroundImage":"#00b4ed"
            }  
        }
    }
}

 

目录结构:

├── packageA
│    └── pages
│      ├── livePlayer
│      ├── liveGoodsList
│      ├── liveBusiness
│      └── livePusher
├── pages
│    ├── index
│      ├── index
│      └── liveWindow
│   └── login
│      └── login

 

页面跳转:

<view class="cardTit" style="padding: 20rpx 20rpx;" @click="goto('liveBusiness')"></view>
goto(name){
    this.$Router.push({
        name:name
    })         
},

 

posted @ 2023-04-19 15:08  石头记1  阅读(235)  评论(0)    收藏  举报