小程序

67 阅读1分钟

保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面

 wx.navigateTo({          url: '',        })

跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面

wx.switchTab({          url: '',        })

关闭所有页面,打开到应用内的某个页面

 wx.reLaunch({          url: '',        })

关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面(使用redirectTo是无法使用navigateBack返回的)

wx.redirectTo({            url: '',        })

Tabbar详解:

{
  "tabBar": {

    "color": "#000000", //tabber文字的颜色

    "selectedColor": "#000000",//选择后文字的颜色

    "backgroundColor": "#000000", //tabber的背景色

    "list": [{
      "pagePath": "page/component/index",//页面路径

      "text": "组件", //名字

       "iconPath":"",//图标

      "selectedIconPath": "" //选择后的图标
    }, {
      "pagePath": "page/API/index",

      "text": "接口",
      "iconPath":"",

      "selectedIconPath": ""
    }]
  }

 setData有哪些缺点?

多次使用setData会影响性能 尽量把多次setData 使用一次setData来实现

尽量少的使用setData来提高小程序的性能