需求:后台跳转预览前台页面然后通过传值取到相应的数据 ,通过vue+iframe 实现 同样你也可以使用到其他场景,效果一样
代码:
// 后台到你的iframe嵌套的页面跳转方法,携带参数
toPreview(index,row) {
let routeData = this.$router.resolve({
name: "ViewFeature",
query: {
featureId: row.featureId,
},
});
window.open(routeData.href, "_blank");
},
,这种方法是新开页面的一种方法如果不需要的话可以把this.$router.resolve直接换成
this.$router.push({
path: "ViewFeature",
query: {
featureId: row.featureId,
},
})
在后台iframe的嵌入页面的html代码
<iframe
:src="r_url"
frameborder="0"
width="