微信小程序在app.json文件中使用了tarbar之后,使用wx.navigatTo无法跳转页面,使用wx.switchTab
一、微信小程序是什么?
2020年前端的趋势,小程序化二、使用步骤
1.创建tarbar
在app.json文件中
代码如下(示例):
"tabBar": {
"color": "#a9b7b7",
"selectedColor": "#3498db",
"borderStyle": "black",
"list": [{
"selectedIconPath": "images/shandian.png",
"iconPath": "images/duihao.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"selectedIconPath": "images/daozhuiti.png",
"iconPath": "images/lifangti.png",
"pagePath": "pages/logs/logs",
"text": "一元投"
},
{
"selectedIconPath": "images/lingxing.png",
"iconPath": "images/yuanzhu.png",
"pagePath": "pages/mine/mine",
"text": "我的"
}
]
},
2.使用wx.switchTab
代码如下(示例):
wx.switchTab({
url: '../index/index',
})