routesLayoutConfigs.js 703 B

12345678910111213141516
  1. import { boot } from 'quasar/wrappers'
  2. // import { getRouteWithParent, createLayoutConfigArray } from 'quasar-template-builder'
  3. import helper from 'quasar-template-builder/src/helper.js'
  4. const { getRouteWithParent, createLayoutConfigArray } = helper
  5. export default boot(({ router, store }) => {
  6. router.beforeEach((to) => {
  7. if (to.meta.breadcrumbs) {
  8. store.commit('AppLayout/updateBreadcrumbs', to.meta.breadcrumbs)
  9. }
  10. const routeWithParent = getRouteWithParent({ children: router.options.routes }, to.name, store)
  11. const layoutArray = createLayoutConfigArray(routeWithParent)
  12. layoutArray.forEach(config => {
  13. store.dispatch('AppLayout/updateStore', config)
  14. })
  15. })
  16. })