vue-router query,parmas,meta传参
生活随笔
收集整理的這篇文章主要介紹了
vue-router query,parmas,meta传参
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.query,顯示在導航欄?后,相當于get請求傳參
this.router.push({path:'/login',query:{ 'redirect':'/home'}}) this.router.push({name:'Login',query:{ 'redirect':'/home'}})2.parmas,不會顯示,相當于post請求傳參, 目前測試沒有query不行,而且刷新后消失
this.router.push({name:'Login',parmas:{ 'redirect':'/home'}}) this.router.push({name:'Login',query:{ 'redirect':'/home'}},parmas:{ 'redirect':'/home'}})在vue中使用parmas傳參時必須用name跳轉,而且必須和query一起傳?否則接收不到;或者路由中有設置/:XX來接收這個參數
3.meta,不顯示,測試失敗
this.router.push({name:'Login',meta:{ 'redirect':'/home'}}) 創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的vue-router query,parmas,meta传参的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vue项目中按需引入viewUI
- 下一篇: vue 监听路由变化