[英]How to pass attributes to Vue.js component in vue router?
如何在 vue 路由器中將屬性傳遞給 vuecomponent?
const routes = [
{
path: "/dashboard/profile",
name: "DashboardProfile",
component: <DashboardProfile foobar="false"/>, // <--- How can I achieve this?
},
];
您可以傳遞一個道具對象,如:
const routes = [
{
path: "/dashboard/profile",
name: "DashboardProfile",
component: DashboardProfile,
props:{show:false}
},
];
然后在您的組件內部使用該道具在組件根部進行條件渲染。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.