首页 > 技术文章 > vue使用this.$router跳转路由与传值取值

coderxin 2021-06-08 14:52 原文

本窗口打开:
  传参:
    this.$router.push({ name: 'info-detail', params: {id: id}})
  取参:
    this.$route.params.id
新窗口打开
  传参:
    window.open(this.$router.resolve({ path: 'info-detail', query: { id: id} }).href,  '_blank')
  取参:
    this.$route.query.id

推荐阅读