methods: { goBack() { // 返回上一页 this.$router.go(-1); // 关闭当前页面; this.$store.dispatch("tagsView/delView", this.$route); } }, mounted(){ if (window.history && window.history.pushState) { history.pushState(null, null, document.URL); window.addEventListener("popstate", this.goBack); } }, destroyed() { window.removeEventListener("popstate", this.goBack); }
标签:返回,vue,浏览器,goBack,window,pushState,null,history From: https://www.cnblogs.com/ronle/p/16825384.html