路由传参
1.字符串形式
query传参
this.$router.push("/search"+"?k="+this.keyword)
params传参需要在路径后占位
this.$router.push("/search/"+ this.keyword)
2.模板字符串
query传参
this.$router.push(`/search?k=${this.keyword}`)
params传参
this.$router.push(`/search/${this.keyword}?`)
3.对象写法
this.$router.push({
//query 对象写法的时候 必须使用name跳转
name:'search',
params:{
keyword:this.keyword
},
query:{
k:this.keyword.toUpperCase()
keyword:this.keyword
}
},) //()=>{},()=>{}