Pass $route as parameter to a Vue JS function

Asked

Viewed 419 times

2

It is possible to pass $route as a parameter for a function?

<v-btn color="info" v-on:click="getProximo('this.$route')">
    Próximo
</v-btn>

I need to get a parameter that’s in $route, but while using this.$route.params.NomeParametro within the function getProximo() does not work, would pass as parameter when calling the function in the click button?

  • 1

    Forehead only v-on:click="getProximo($route)">

  • @Sergio worked!!

1 answer

1


If the $store is a property of the component you can use so:

<v-btn color="info" v-on:click="getProximo($route)">
  Próximo
</v-btn>

Or else use v-on:click="getProximo" and then within the method:

methods: {
    getProximo(event){
        const route = this.$route;
        // etc...
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.