fix(app): throw an error when layout property is not string (#4142)

This commit is contained in:
Kenta Suzuki 2018-10-21 04:47:47 +09:00 committed by Pooya Parsa
parent ec559750c1
commit f5530ad653

View File

@ -83,6 +83,9 @@ export default {
<% } %> <% } %>
<% if (splitChunks.layouts) { %> <% if (splitChunks.layouts) { %>
setLayout (layout) { setLayout (layout) {
<% if (debug) { %>
if(layout && typeof layout !== 'string') throw new Error('[nuxt] Avoid using non-string value as layout property.')
<% } %>
if (!layout || !resolvedLayouts['_' + layout]) layout = 'default' if (!layout || !resolvedLayouts['_' + layout]) layout = 'default'
this.layoutName = layout this.layoutName = layout
let _layout = '_' + layout let _layout = '_' + layout
@ -110,6 +113,9 @@ export default {
} }
<% } else { %> <% } else { %>
setLayout(layout) { setLayout(layout) {
<% if (debug) { %>
if(layout && typeof layout !== 'string') throw new Error('[nuxt] Avoid using non-string value as layout property.')
<% } %>
if (!layout || !layouts['_' + layout]) { if (!layout || !layouts['_' + layout]) {
layout = 'default' layout = 'default'
} }