How to bypass beforeRouteLeave Nuxtjs components

Viewed 54

I use beforeRouteLeave for open dialog component when calling component with router.

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

When I call nuxt-link to the read-content (route.name) page a dialog opens. Sometimes I don't want to run the dialog. But I want to access that page directly, what should I do?

1 Answers

I found my answer, i use condition in parameter to -> if(to.hash) add token or fake param after route/# url.
If there is any other better way please suggest me.

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