uni-app h5 end Jump in the end section of the navigation bar when using the method to update the data to refresh the page jump uni.switchTab

h5 end of the uni-app items

Demand: uni-app h5 end Jump in the end section of the navigation bar when using the method to update the data to refresh the page jump uni.switchTab

Baidu method is as follows:

uni.switchTab({
    url: '/pages/index/main',
    success: function (e) { 
      var page = getCurrentPages().pop();
      console.log('page',page)
      if (page == undefined || page == null) return;
      page.onLoad();
    } 
})

But it will error when I run this, saying t.onLoad is not a function

I judge them after the output node of the error page to get

getCurrentPages () to get the two nodes, the first node is the real page node, and page acquired node is the second node

Rude way points are:

var page = getCurrentPages()[0]

Tender point is this:

let the = getCurrentPages () 
le.pop () 
var page = le.pop ()

Here do not know how you can go to search pop () usage

 

Then continue to page.onLoad (), I can not get to find, so I changed page.ceshi (), write a method to refresh the data in ceshi () method in, so this problem is resolved.

The final code is as follows:

uni.switchTab({
    url: '/pages/tabBar/order/order',
    success: function (e) {
    var page = getCurrentPages()[0]
    if (page == undefined || page == null) return;
    page.ceshi(); 
    }
});

Guess you like

Origin www.cnblogs.com/miluluyo/p/11202838.html