我对小程序了解很少,甚至前端水平还停留在jquery那个层面。话很少说,先看看出了什么问题?前端
这个小程序是某商城的小程序,发现首页自定义一些菜单导航过去都是错误的。例如原本想要跳转到“热门商品”页去(pages/goods/index/index?ishot=1),但怎么弄都只能跳转到pages/goods/index/index(query参数丢失了),并产生一条警告:“wx.switchTab: url 不支持 queryString”。百度了好一会:都是“先存储到全局js中,再到目标页onShow时再进行处理” blog.csdn.net/qq_29644709…jquery
但我记忆中看过其余小程序是支持带querystring的导航,因而我分析了源码,确实没找到相关的代码实现,正当失望的时候,忽然发现导航里有一个pages/goods/index/index, 我猜测 这里定义了(无querystring,因此其余地方就不能用了),我尝试将pages/goods/index/index 修改成 pages/category/index/index后,问题获得解决。json
#app.json导航部分
"tabBar": {
"color": "#999999",
"selectedColor": "#ff5555",
"borderStyle": "white",
"backgroundColor": "#f7f7fa",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/images/tabbar/icon-1.png",
"selectedIconPath": "static/images/tabbar/icon-1-active.png"
},
{
"pagePath": "pages/category/index/index",
"text": "所有分类",
"iconPath": "static/images/tabbar/icon-2.png",
"selectedIconPath": "static/images/tabbar/icon-2-active.png"
},
{
"pagePath": "pages/member/cart/index",
"text": "购物车",
"iconPath": "static/images/tabbar/icon-4.png",
"selectedIconPath": "static/images/tabbar/icon-4-active.png"
},
{
"pagePath": "pages/member/index/index",
"text": "会员中心",
"iconPath": "static/images/tabbar/icon-5.png",
"selectedIconPath": "static/images/tabbar/icon-5-active.png"
}
]
}
复制代码