方法1 if(window.name == ""){ console.log("首次被加载1"); window.name = "isReload"; // 在首次进入页面时我们可以给window.name设置一个固定值 }else