解决方法:
1.使用window.open打开新窗口
2.使用cookie进行跨页面同源数据传递
goToComment(id) {
// 存储传递参数
this.$cookies.set("article", id)
// 存储要跳转的菜单
sessionStorage.setItem("cur-menu-name", "comments")
// 打开新的窗口自己get到sseionStorage里面的菜单
window.open("/", "_blank")
}
// 此方法放在mounted钩子上
isFromArticle() {
let article_id = this.$cookies.get("article")
if (article_id) {
// 取出id
this.queryParams.article_key = article_id
sessionStorage.setItem("cur-menu-name", "article")
this.$cookies.set("article", "")
}
}