vue iframe页面刷新停留在当前页面
在跳转iframe的时候 把 iframe 存储下来
刷新后判断是否存在保存的iframe
如果有 就赋值
刷新后判断是否存在保存的iframe
如果有 就赋值
sliderClick(i, item) {
this.sIndex = item.id;
this.toggleSlider = true;
this.iframeId = item.id;
this.iframeUrl = item.linkUrl;
localStorage.setItem("iframeUrl", item.linkUrl);
localStorage.setItem("iframeId", item.id);
},
mounted() { if (localStorage.getItem("iframeUrl") && localStorage.getItem("iframeId")) { this.iframeUrl = localStorage.getItem("iframeUrl"); this.iframeId = localStorage.getItem("iframeId"); this.sIndex = localStorage.getItem("iframeId"); } }, created() { this.rout(); this.$root.eventHub.$off("iframesDate"); this.$root.eventHub.$on("iframesDate", (res) => { this.iframeUrl = res.linkUrl; this.sIndex = res.id; localStorage.setItem("iframeUrl", res.linkUrl); localStorage.setItem("iframeId", res.id); }); },