yaquawa
yaquawa

Reputation: 7338

How to pass attributes to Vue.js component in vue router?

How to pass attributes to vuecomponent in vue router?

const routes = [
    {
        path: "/dashboard/profile",
        name: "DashboardProfile",
        component: <DashboardProfile foobar="false"/>, // <--- How can I achieve this?
    },
];

Upvotes: 1

Views: 116

Answers (1)

Boussadjra Brahim
Boussadjra Brahim

Reputation: 1

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.

Upvotes: 3

Related Questions