<!-- Argu.vue -->
<template>
<div class="argu">
<h1>{{name}}</h1>
</div>
</template>
<script>
export default {
props: {
name: {
type: String,
required:true,
default: "chj"
}
}
};
</script>
//对应的路由配置
{
path: "/argu/:name",
component: () => import("../views/Argu.vue"),
props:true
}
代码如上。
为什么访问/argu
这个路径的时候组件不显示chj
呢?
参考链接: https://router.vuejs.org/zh/g...
/argu 没带 props ,所以访问不到 Argu 组件,如果想 /argu 能访问到