uniapp jump to tab page and pass parameters

Click the list on the [Homepage] to jump to the [Real Time] page and load the data, as shown in the following figure:

【Home】Click event of the list:

showPdsWendu(jid){
      uni.setStorageSync('mainJid',jid);
      uni.switchTab({
          url: `/pages/tem/tem`,    //要跳转的路径
           success: function (e) {
              var page = getCurrentPages()[0]
              if (page == undefined || page == null) return;
              page.onLoad(); 
              }

      })
    },

1. Jumps between tab pages cannot pass parameters and can only be stored in the local cache. Such as: uni.setStorageSync('mainJid',jid);

2. Jump to tab page, use uni.switchTab

3. The method of loading the tab page page.onLoad(); 

[Real time] onLoad() of the page

 onLoad() {
         if (uni.getStorageSync('mainJid')>=0) {
                 }
  },

 

 

Guess you like

Origin blog.csdn.net/orangapple/article/details/109534402