Refresh the current page in uniapp
method one
Use routing to force uniapp to refresh the current page
setTimeout(() => {
this.$router.go(0)
}, 500)
Method Two
Close the current page and jump to a given page in the application (you can also use this method if you want to refresh the current page):
uni.redirectTo({
url: '../details/details?gid=' + this.gid //写你的路径
});
You can also optimize this method with a timer to delay the animation slightly
setTimeout( () => {
uni.redirectTo({
url: '../details/details?gid=' + this.gid
});
}, 500)
method three
Refresh the page by getting the page instance to execute its internal life cycle method
reload() {
// 页面重载
const pages = getCurrentPages()
// 声明一个pages使用getCurrentPages方法
const curPage = pages[pages.length - 1]
// 声明一个当前页面
curPage.onLoad(curPage.options) // 传入参数
curPage.onShow()
curPage.onReady()
// 执行刷新
},