I am working on a vuetify autocomplete search feature. When a user selects an item, I need to navigate to a specific route and pass some props along.
However, my attempts to change the current route without passing props have resulted in errors. Here is what I tried:
v-on:input="this.window.location.href = '/markets'"
v-on:input="this.$router.push({path: '/markets'})"
Both of these approaches gave me the following errors:
Error in v-on handler: "TypeError: Cannot read property 'location' of undefined"
Error in v-on handler: "TypeError: Cannot read property '$router' of null"
So my question is, how can I successfully change the route and pass props to the "Markets" component within the event handler?
EDIT: Instead of directly changing the route, I tried using a method:
I encountered the same error with
v-on:input="goToMarkets()"
methods: {
goToMarkets(){ this.window.location.href = '/markets' }
}
Error in v-on handler: "TypeError: Cannot read property 'location' of undefined"