记一个vue问题this.$router

1,143 阅读1分钟

在子组件中使用this.$router.push进行跳转,但是提示this.$router.push is undefined


看到报错,打印出this,里面的router竟然显示undefined

如下:


解决:

在子组件中引入router
然后就正常了。