vue中:
方式一:
傳遞:
this.$router.push({ path: '', query: { key: value,key: value } })
接受: this.$route.query.xxx
方式二(此方法傳的的參數(shù)不會在url地址欄中顯示出來):
傳參:
this.$router.push({
name: '', //此處的name值在路由表中的要跳轉(zhuǎn)至那個頁面的name值,也是由于nuxt 中路由表乃自動生成阅懦,故nuxt中不能用此方法
params: { key: 'value, key: 32 }
})
接收
this.$route.params.xxx
方式三:
須在路由中配置 { path: '/c/:id', name: 'C',component: C }
傳this.$router.push('/c/58')
接收 this.$route.params.id
傳this.$router.push('/c') (注意:這種方式不可取)
接收 this.$route.params.id(此時頁面的生命周期不會執(zhí)行)
傳 :this.$router.push({ path: `/c/58`,query: {name: '桐梓' } })
接收 this.$route.params.id this.$route.query.xxx