1. 程式人生 > >微信小程式 wx.reLaunch 執行前幾個頁面的 onUnload 鉤子

微信小程式 wx.reLaunch 執行前幾個頁面的 onUnload 鉤子

微信小程式 wx.reLaunch 執行前幾個頁面的 onUnload 鉤子

解決方案

有種場景:頁面 A => B => C => D, 當在 C 頁面呼叫 wx.reLaunch({url:’/pages/D’}) 時,頁面 A 、B、C 的 onUnload 事件都會執行,這是小程式的觸發規律,根據自己業務場景看需要怎麼處理一些事情。