如何绕过beforeroutleave Nuxtjs组件



当使用router调用组件时,我使用beforeRouteLeave打开dialog component

beforeRouteLeave(to, from, next) {
if (to.name === "read-content") {
this.displayProductModal(to);
} else {
next();
}
},

当我调用next -link到read-content(route.name)页面时,会打开一个对话框。有时我不想运行对话框。但我想直接访问那个页面,我该怎么做?

我找到了我的答案,我在参数to->if(to.hash)route/#url后面添加token或fake参数。
如果有更好的方法,请告诉我。

:to="{
name: 'read-content',
params: { content: id },
hash: '#x',
}"

最新更新