fix: set default name to layout to avoid multi mounted (#7128)

This commit is contained in:
Sébastien Chopin 2020-03-25 19:14:17 +01:00 committed by GitHub
parent 90c6922f42
commit b82f8d1640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,8 @@ import {
getMatchedComponentsInstances,
getChildrenComponentInstancesUsingFetch,
promisify,
globalHandleError
globalHandleError,
sanitizeComponent
} from './utils'
<% } %>
<% if (features.layouts && components.ErrorPage) { %>import NuxtError from '<%= components.ErrorPage %>'<% } %>
@ -23,7 +24,7 @@ import '<%= relativeToBuild(resolvePath(c.src || c, { isStyle: true })) %>'
}
}).join('\n') %>
const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": _${hash(key)}`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": sanitizeComponent(_${hash(key)})`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
<% if (splitChunks.layouts) { %>let resolvedLayouts = {}<% } %>
<% } %>

View File

@ -80,7 +80,7 @@ export function sanitizeComponent (Component) {
Component._Ctor = Component
Component.extendOptions = Component.options
}
// For debugging purpose
// If no component name defined, set file path as name, (also fixes #5703)
if (!Component.options.name && Component.options.__file) {
Component.options.name = Component.options.__file
}