我想router.go
在组件内部调用
目前我已经设置了window.router = router
//代码
index.js
const App = Vue.extend(require('./views/app.vue'))
router.start(App, '#app')
window.router = router // I don't want to set this global variable
导航栏
methods: {
search () {
window.router.go({
name: 'search',
query: { q: this.query }
})
}
}
我正在寻找的是这样的, this.$router.go
导航栏
methods: {
search () {
this.$router.go({
name: 'search',
query: { q: this.query }
})
}
}
谢谢,非常感谢您的帮助