onBackPress returns to the previous level and refreshes the page content to obtain the latest data
The onBackPress method is uinapp’s own return key method, which is the return key in app and H5
onBackPress() {
setTimeout(() => {
uni.switchTab({
url: '/pages/Users/index',
})
}, 300)
return true
},
methods: {
}
Here you need to add a delay in uni.switchTab, otherwise an error will be reported. This is the upper left corner of the current level.
Then call it in your previous page
B page
onShow() {
this.getdata()
},
Used to get the latest data, just assign it to it
注意:主要:在这里 onShow是生命周期中 每次只要已进入这个页面都会调用这个生命周期,onload中是只调用一次