当使用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',
}"