Fix layouts
This commit is contained in:
parent
462f44a99c
commit
bf64c01646
|
@ -47,7 +47,7 @@ import Notifications from "./common/Notifications.vue"
|
||||||
import SeoMeta from '../mixins/seo-meta.js'
|
import SeoMeta from '../mixins/seo-meta.js'
|
||||||
|
|
||||||
// Load layout components dynamically.
|
// Load layout components dynamically.
|
||||||
const requireContext = import.meta.glob('../layouts/**.vue')
|
const requireContext = import.meta.glob('../layouts/**.vue', { eager: true })
|
||||||
|
|
||||||
const layouts = {}
|
const layouts = {}
|
||||||
Object.keys(requireContext)
|
Object.keys(requireContext)
|
||||||
|
@ -86,7 +86,7 @@ export default {
|
||||||
confirmationCancel: null
|
confirmationCancel: null
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$loading = this.$refs.loading
|
this.$loading = this.$refs.loading
|
||||||
},
|
},
|
||||||
|
|
|
@ -86,7 +86,13 @@ async function beforeEach (to, from, next) {
|
||||||
callMiddleware(middleware, to, from, (...args) => {
|
callMiddleware(middleware, to, from, (...args) => {
|
||||||
// Set the application layout only if "next()" was called with no args.
|
// Set the application layout only if "next()" was called with no args.
|
||||||
if (args.length === 0) {
|
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)
|
next(...args)
|
||||||
|
|
Loading…
Reference in New Issue