小程序
小游戏
企业微信
微信支付
扫描小程序码分享
tabBar用的是官方demo里面的代码,但是官方引入的demo可以运行,自己新建了一个小程序空项目引入,点击切换的时候没反应,也不报错,调试发现调用失败。
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
打印一下fail回调 的返回值啊!
fail:(failResult)=>{ console.log(failResult) }
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
errMsg: "switchTab:fail page "pages/index/pages/personal/personal" is not found"
wx.switchTab 的 URL 应该是以 / 开头
wx.switchTab
/
建议写法 /pages/personal/personal
app.json如下,但是我将custom值改为false又可以了(官方的是true,放项目里就不行),这是为什么?
{ "pages": [ "pages/index/index", "pages/personal/personal" ], "tabBar": { "custom": true, "color": "#7A7E83", "selectedColor": "#3cc51f", "borderStyle": "black", "backgroundColor": "#ffffff", "list": [ { "pagePath": "pages/index/index", "iconPath": "image/icon_component.png", "selectedIconPath": "image/icon_component_HL.png", "text": "组件" }, { "pagePath": "pages/personal/personal", "iconPath": "image/icon_API.png", "selectedIconPath": "image/icon_API_HL.png", "text": "我的" } ] }, "window": { "backgroundTextStyle":"light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "WeChat", "navigationBarTextStyle":"black" }, "style": "v2", "componentFramework": "glass-easel", "sitemapLocation": "sitemap.json", "lazyCodeLoading": "requiredComponents" }
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
打印一下fail回调 的返回值啊!
fail:(failResult)=>{ console.log(failResult) }
errMsg: "switchTab:fail page "pages/index/pages/personal/personal" is not found"
wx.switchTab
的 URL 应该是以/
开头app.json如下,但是我将custom值改为false又可以了(官方的是true,放项目里就不行),这是为什么?
{ "pages": [ "pages/index/index", "pages/personal/personal" ], "tabBar": { "custom": true, "color": "#7A7E83", "selectedColor": "#3cc51f", "borderStyle": "black", "backgroundColor": "#ffffff", "list": [ { "pagePath": "pages/index/index", "iconPath": "image/icon_component.png", "selectedIconPath": "image/icon_component_HL.png", "text": "组件" }, { "pagePath": "pages/personal/personal", "iconPath": "image/icon_API.png", "selectedIconPath": "image/icon_API_HL.png", "text": "我的" } ] }, "window": { "backgroundTextStyle":"light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "WeChat", "navigationBarTextStyle":"black" }, "style": "v2", "componentFramework": "glass-easel", "sitemapLocation": "sitemap.json", "lazyCodeLoading": "requiredComponents" }