Monitor each page of uniapp

current page on exit

uni.$emit("zxpg", {    zxpg: res.tips,  });  uni.navigateBack(); // Return to the previous page



OnShow of the previous page

uni.$on("zxpg", (data) => {   console.log("receiving event test is successful, data=", data);   });


Note that the this point in uni.$on("zxpg", (data) => {}); will change
 

Guess you like

Origin blog.csdn.net/weixin_51426266/article/details/126851793