VUE路由傳參主要的3種方式

2021-08-20 04:58:17 字數 649 閱讀 8164

vue路由傳參有3種方式

1)query方式

(push時使用path來匹配)

發起頁面:

this.$router.push(

});路由配置:

routes: [

]接受引數頁面:

export default}}

跳轉轉收頁面的時候,位址列會顯示:

2)params模式

(push時使用name來匹配)

發起頁面:

this.$router.push(

});路由配置:

routes: [

]接收引數頁面:

export default}}

跳轉轉收頁面的時候,位址列顯示目的位址,不帶任何引數

3)location預宣告引數模式

(push使用path來匹配,但是它跟params模式不同)

發起頁面:

this.$router.push();

路由配置:

routes: [

]接收引數頁面:

export default}}

路由跳轉時,url會顯示:

VUE路由傳參有3種方式

vue路由傳參有3種方式 1 query方式 push時使用path來匹配 發起頁面 this.katex parse error expected got eof at end of input eturn 跳轉轉收頁面的時候,位址列會顯示 2 params模式 push時使用name來匹配 發起...

vue的路由傳參的3種方式

push 有兩種方式 一種是通過path,一種是通過name。然後無論是path還是name都有params和query方式進行傳遞,如下 type 居住類 this.router.push this.router.push this.router.push this.router.push 到這裡...

react路由傳參 3種方式

1 params傳參 重新整理頁面後引數不消失,引數會在位址列顯示 路由頁面 注意要配置 id 路由跳轉並傳遞引數 或 xx js方式 this.props.history.push demo 6 或 this.props.history.push 獲取引數 this.props.match.par...