uniapp 跳转tab页,并传递参数

点击【首页】上的列表,跳转到【实时】 页面,并加载数据,如下图所示:

【首页】列表的点击事件:

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. tab页之间的跳转,不能传递参数,只能存在本地缓存里。如:  uni.setStorageSync('mainJid',jid);

2. 跳转tab页,用 uni.switchTab

3、加载tab页的方法   page.onLoad(); 

【实时】 页面的onLoad()

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

猜你喜欢

转载自blog.csdn.net/orangapple/article/details/109534402