fix(nuxt): do not warn for non-existent default layout (#7748)

This commit is contained in:
Daniel Roe 2022-09-22 14:54:55 +01:00 committed by GitHub
parent 1c26e07141
commit b68cf0706d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ export default defineComponent({
if (process.dev && process.client) { if (process.dev && process.client) {
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
if (_layout && ['#comment', '#text'].includes(vnode?.el?.nodeName)) { if (_layout && _layout in layouts && ['#comment', '#text'].includes(vnode?.el?.nodeName)) {
console.warn(`[nuxt] \`${_layout}\` layout does not have a single root node and will cause errors when navigating between routes.`) console.warn(`[nuxt] \`${_layout}\` layout does not have a single root node and will cause errors when navigating between routes.`)
} }
}) })