美文网首页
vue 路由传递参数

vue 路由传递参数

作者: Mokingc | 来源:发表于2019-12-13 17:04 被阅读0次

父组件:

<template>
  <div>
   <el-button type="primary" @click="toProblem()">查看详情</el-button>
  </div>
</template>
<script>
methods: {
    toProblem() {
      this.$router.push({
        name: "problem",
        params: {
          id:123
        }
      });
    }
  },
</script>

跳转路由子组件:

<template>
  <div>
    题目详情
    {{this.$route.params.id}}
  </div>
</template>

相关文章

网友评论

      本文标题:vue 路由传递参数

      本文链接:https://www.haomeiwen.com/subject/rwzfnctx.html