WeChat applet routing and jump page passing parameters

routing

Write in the pages of app.json

"pages/pages/pages" It is very convenient to directly save pages and generate them directly.

 Jump page

wx.navigateTo() retains the current page and jumps to a non-tabBar page within the application.

<text bindtap="daka">Click</text>

 daka:function () {
    wx.navigateTo({
      url: '../daka/daka',
    })
  },

Return arrow will be retained

Just write the bottom navigation jump in app.json
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页"
    }, {
      "pagePath": "pages/home/home",
      "text": "日志"
    }]
  },

Passing and receiving parameters

1. Local storage

Usage: almost the same as js

    wx.setStorageSync()

2、wx.getStorage

Asynchronously obtain the content of the specified key from the local cache

3、wx.removeStorage

Remove the specified key from the local cache

4、wx.clearStorage

clear all cache

Jump parameters

<view bindtap="title_tiaozhuan" data-id="{ {item.id}}">点击</view>

  title_tiaozhuan:function (e) {
    let {id} = e.target.dataset;
    console.log(e.currentTarget.dataset.id);
    wx.setStorageSync('daka_l',e.currentTarget.dataset.id)//地图要用到的数据
    wx.navigateTo({
      url: '../liebiao/liebiao',
    })
  },

Receive parameters: take them out and use them directly

  let ssr = wx.getStorageSync('daka_l');


 

Guess you like

Origin blog.csdn.net/A12536365214/article/details/132444971