I try to navigate into my nuxt-child with a slider. In order to that, i want to use this.$router.push() in a methods but it's not working
Cannot read property 'push' of undefined
This my error
export default {
data () {
const vue = this
return {
intro: {
title: 'Toutes les Actualités',
content: 'Retrouvez toutes les actualités concernant le monde du surf et la Fédération Française de Surf. Ne loupez aucune nouveauté !'
},
links: ['sportives', 'federales', 'regionales'],
swiperOptionLinks: {
mousewheel: {
forceToAxis: true,
invert: true
},
slidesPerView: 2,
spaceBetween: 5,
centeredSlides: true,
on: {
touchEnd () {
console.log('touchEnd', this.realIndex)
vue.methods.navigate(this.realIndex)
}
}
},
methods: {
navigate (index) {
console.log(index)
this.$router.push('/actualites/'+index)
}
}
}
}
}
Anyone knows how can access to Router in methods ?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2295">#c2295</a>)</em></sub></div>