微信小程序路由跳转

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

<view class="classify" bindtap='todetail'>点我跳转</view>

js

  todetail:function(e){
  //新页面路由跳转
  wx.navigateTo({
    url: '../detail/detail'   //实际路径要写全
  })
},
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容