赞
踩
最近在做一个uniapp开发的小程序遇到一个需求,希望不同用户登录后展示不同的tabbar页面,但是uniapp项目中的pages.json是只有一个list数组的,并且是不能写成动态效果,为了实现这个需求,便自定义了tabbar组件
pages.json配置tabbar的基本路径(只需路径即可)
{ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { "path" : "pages/login/login", "style" : { "navigationBarTitleText": "", "enablePullDownRefresh": false } }, { "path": "pages/index/index", "style": { "navigationBarTitleText": "" } } ,{ "path" : "pages/my/my", "style" : { "navigationBarTitleText": "", "enablePullDownRefresh": false } } ,{ "path" : "pages/warn/warn", "style" : { "navigationBarTitleText": "", "enablePullDownRefresh": false } } ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uni-app", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" }, "uniIdRouter": {}, "tabBar": { "color": "#999", "selectedColor": "#0aa671", "borderStyle": "white", "list": [ { "pagePath": "pages/index/index" }, { "pagePath": "pages/warn/warn" }, { "pagePath": "pages/my/my" } ] } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。