[英]How to pass attributes to Vue.js component in vue router?
How to pass attributes to vuecomponent in vue router?如何在 vue 路由器中将属性传递给 vuecomponent?
const routes = [
{
path: "/dashboard/profile",
name: "DashboardProfile",
component: <DashboardProfile foobar="false"/>, // <--- How can I achieve this?
},
];
You could pass a prop object like :您可以传递一个道具对象,如:
const routes = [
{
path: "/dashboard/profile",
name: "DashboardProfile",
component: DashboardProfile,
props:{show:false}
},
];
then inside your component use that prop for conditional rendering at the component root.然后在您的组件内部使用该道具在组件根部进行条件渲染。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.