Fix layouts

This commit is contained in:
JhumanJ 2023-01-26 10:52:48 +01:00
parent 462f44a99c
commit bf64c01646
2 changed files with 9 additions and 3 deletions

View File

@ -47,7 +47,7 @@ import Notifications from "./common/Notifications.vue"
import SeoMeta from '../mixins/seo-meta.js'
// Load layout components dynamically.
const requireContext = import.meta.glob('../layouts/**.vue')
const requireContext = import.meta.glob('../layouts/**.vue', { eager: true })
const layouts = {}
Object.keys(requireContext)
@ -86,7 +86,7 @@ export default {
confirmationCancel: null
}
}),
mounted () {
this.$loading = this.$refs.loading
},

View File

@ -86,7 +86,13 @@ async function beforeEach (to, from, next) {
callMiddleware(middleware, to, from, (...args) => {
// Set the application layout only if "next()" was called with no args.
if (args.length === 0) {
router.app.setLayout(components[0].layout || '')
if (components[0].layout) {
router.app.setLayout(components[0].layout)
} else if (components[0].default && components[0].default.layout) {
router.app.setLayout(components[0].default.layout)
} else {
router.app.setLayout('')
}
}
next(...args)