Home  >  Q&A  >  body text

javascript - vue2.0 route passes parameters. The parameter received when jumping to the page is undefind, but it is obtained after refreshing. Why?

This is an id parameter passed by the jump page

This is the page that receives parameters

This is the result of jumping to the past

This is the id obtained after refreshing

淡淡烟草味淡淡烟草味2711 days ago510

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:16:38

    Put it in mounted and try it

    reply
    0
  • 阿神

    阿神2017-05-19 10:16:38

    This $route$router 不是一个东西吧。。
    一边都用 this.$route.push({ path: '/yourpath', query: {id: 123})
    另外一边直接 console.log(this.$route.query.id)

    reply
    0
  • Cancelreply