refreshPage(){
const pages = getCurrentPages()
const perpage = pages[pages.length - 1] //当前页面
const keyList = Object.keys(perpage.options) //当前页面携带的路由参数
if(keyList.length > 0){
let keys = ‘?’
keyList.forEach((item, index) =>{
index === 0 ?
keys = keys + item + ‘=’ + perpage.options[item] : keys = keys + ‘&’ + item + ‘=’ + perpage.options[item] })
wx.reLaunch({
url: ‘/’ + perpage.route + keys
})
}else{
wx.reLaunch({
url: ‘/’ + perpage.route //当前页面路由地址
})
}
}
小程序刷新当前页面
最新推荐文章于 2024-08-29 16:30:28 发布