visibilitychange(vc贝雷忒change)

document.addEventListener("visibilitychange", function() {
  if(document.visibilityState === "visible"){
    console.log(“hello,显示咯")
  }
  if(document.visibilityState === "hidden"){
    console.log("离开当前页")
  }
});