Pass value to component with Vuejs

2

I have the following structure in my project

 1. App.vue (Arquivo principal)
 2. App.vue (outro arquivo que fica dentro da pasta paginas)
 3. Dashboard.vue (filho do 2 app.vue)

Within my second app.vue I call component Menu , the question is, how would I go about passing the data to component Menu ?

NOTE: This is a dashboard, and when I log in, I have the user data, which I want to put in the Menu

index.js

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/dashboard',
      name: 'Dashboard',
      children: [
        {
          name: 'DashboardA',
          path: '/',
          component: Dashboard,
          meta: { requiresAuth: true }
        },
        {
          path: '/cardapio',
          name: 'Cardapio',
          component: Itens
        },
        {
          path: '/categorias',
          name: 'Categorias',
          component: Categorias
        },
        {
          path: '/categorias',
          name: 'Categorias',
          component: Categorias
        },
        {
          path: '/subcategorias',
          name: 'SubCategorias',
          component: SubCategorias
        },
        {
          path: '/clientes',
          name: 'Clientes',
          component: Clientes
        }
      ],
      component: AppDashboard
    }
  ]
})

I know that if I call the component on the page, I can pass data via props , but in that case, I go to Dashboard , but the menu is in App.vue , how would you do? >     

asked by anonymous 09.10.2017 / 20:20

1 answer

0
  • Install Vuex
  • Create a store for user data
  • Update employee information when signing in
  • Consume the data in any component
  • 19.07.2018 / 14:43