S
S
Sergeyjed2019-03-21 17:04:57
Vue.js
Sergeyjed, 2019-03-21 17:04:57

How to stop following a link in vue.js?

Clicking does not stop the link.

<router-link @click.prevent="" to="/about/">about</router-link>

Why doesn't it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Ermilichev, 2019-03-21
@Masas

<router-link to="..." @click.native="skip">about</router-link>

const app = new Vue({
  router,
  methods: {
    skip: function(e) {
         e.preventDefault()
    } 
  }
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question