鍍金池/ 問答/HTML/ router-link傳的參數(shù),在vue-router中可以獲取到嗎?可以的話要

router-link傳的參數(shù),在vue-router中可以獲取到嗎?可以的話要怎么獲取參數(shù)?

【問題】:界面通過router-link的形式傳遞參數(shù),在vue-router/index.js路由中,我想獲取到這個參數(shù),可以獲取到嗎?要怎么獲?。浚ú皇窃谙聜€界面中獲取,而是在路由中哦~)
【描述】:我試過this.$route.query.name的形式,發(fā)現(xiàn)獲取不到
【代碼】:

x.vue
<router-link :to="{path:'/account/modify', query:{name: item.name}}"></router-link>

router/index.js
 props: {
    header: {
      title: this.$route.query.name,
      ...
    }
  }
  

header.vue

export default {
    props: [...,'title',...],
    ...
}

【錯誤提示】:

clipboard.png

各位大神請問下,我要如何在vue-router中獲取傳過來的參數(shù)?
注:其他方式在目標(biāo)界面中可以通過this.$route.query.name的方式獲取到,但是我目前只想知道這種方式要如何獲取到,因?yàn)楸救藙側(cè)肟?,所以想多嘗試幾種方式

回答
編輯回答
遲月
beforeRouteEnter (to, from, next) {
  
}
2017年7月31日 23:01