1.不带参数
<router-link :to="{name:'index'}">
<router-link :to="{path:'/index'}">
this.$router.push('/index')
this.$router.push({name:'index'})
this.$router.push({path:'/index'})
2.传递参数
<router-link :to="{name:'index', params: {id:1}}">
//query传参
this.$router.push({name:'home',query: {id:'1'}})
this.$router.push({path:'/home',query: {id:'1'}})
// html 取参 $route.query.id
// script 取参 this.$route.query.id
//params传参
this.$router.push({name:'home',params: {id:'1'}}) // 只能用 name
// html 取参 $route.params.id
// script 取参 this.$route.params.id