vue路由跳转有四种方式
-
router-link
-
this.$router.push() (函数里面调用)
-
this.$router.replace() (用法同push)
-
this.$router.go(n)
一、不带参
1.1 router-link
//name,path都行, 建议用name // 注意:router-link中链接如果是'/'开始就是从根路由开始,如果开始不带'/',则从当前路由开始。1.2 this.$router.push()
this. r o u t e r . p u s h ( ′ / h o m e ′ ) t h i s . router.push('/home') this. router.push(′/home′)this.router.push({name:‘home’})
this. r o u t e r . p u s h ( p a t h : ′ / h o m e ′ ) 1.3 t h i s . router.push({path:'/home'}) 1.3 this.