1.字符串形式
this.$router.push('/search'+this.keyword') params传参
//在注册路由的时候,用到占位,切记务必要传递params,query不需要占位
this.$router.push('/search ?k='+this.keyword) query 传参
2.模板字符串
this.$router.push(`/search${this.keyword}`)
this.$router.push(`/search?k=${this.keyword}`)
3.对象形式(常用)
this.$router.push({
name:'search' //对象形式传参是根据组件名称传参,不是路径
params:{keyword:this.keyword}
//query:{k:this.keyword}
})