微信小程序路由跳转

Tab切换

"tabBar": {
"color": "black",    //默认颜色
"borderStyle": "#000",  //边框
"selectedColor": "red",    //替换时小图标下方更换的颜色
  "list": [
  {
    "pagePath":"pages/index/index",   //要跳转的目标组件的路径
    "text": "首页",                 //tab文字
    "iconPath":"static/home.png",   //默认小图标路径
    "selectedIconPath": "static/home-1.png"  //点击替换的小图标路径
    
  },
  {
    "pagePath":"pages/classify/classify",
    "text": "分类",
    "iconPath": "static/list.png",
    "selectedIconPath": "static/list-1.png"
  },
  {
    "pagePath": "pages/shopcar/shopcar",
    "text": "购物车",
    "iconPath": "static/shopCar.png",
    "selectedIconPath":"static/shopCar-1.png"
    
  },
  {
    "pagePath": "pages/people/people",
    "text": "个人",
    "iconPath": "static/user.png",
    "selectedIconPath":"static/user-1.png"
  }
]
}
//新建static文件放图片(阿里图标可下载)
//下载路径://     http://www.iconfont.cn/

跳转新的页面

HTML

点我跳转

js

  todetail:function(e){
  //新页面路由跳转
  wx.navigateTo({
    url: '../detail/detail'   //实际路径要写全
  })
},

你可能感兴趣的:(微信小程序路由跳转)