vue路由跳转 this.$router.go()
官方文档:https://cn.vuejs.org/v2/guide/migration-vue-router.html#%E7%BC%96%E7%A8%8B%E5%AF%BC%E8%88%AA1、返回上一頁<button @click="goback">返回上页</button>methods:{goback(){thi
·
官方文档:https://cn.vuejs.org/v2/guide/migration-vue-router.html#%E7%BC%96%E7%A8%8B%E5%AF%BC%E8%88%AA
1、返回上一頁
<button @click="goback">返回上页</button>
methods:{
goback(){
this.$router.go(-1)
}
}
2、跳轉至指定頁面路由
<button @click="goToLink">返回page1</button>
methods:{
goToLink(){
this.$router.push('/page1')
}
也可以這樣寫
this.$router.push({name:'page1'})
更多推荐
已为社区贡献1条内容
所有评论(0)