父组件:
<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>