App.vue: check resolvedLayouts in setLayout

This commit is contained in:
Wu Haotian 2017-08-07 15:11:47 +08:00
parent 4abbb4eb9c
commit e686844b03
No known key found for this signature in database
GPG Key ID: 9A146A3AA793AACB

View File

@ -35,14 +35,14 @@ export default {
<% } %> <% } %>
methods: { methods: {
setLayout (layout) { setLayout (layout) {
if (!layout || !layouts['_' + layout]) layout = 'default' if (!layout || !resolvedLayouts['_' + layout]) layout = 'default'
this.layoutName = layout this.layoutName = layout
let _layout = '_' + layout let _layout = '_' + layout
this.layout = layouts[_layout] this.layout = resolvedLayouts[_layout]
return this.layout return this.layout
}, },
loadLayout (layout) { loadLayout (layout) {
if (!layout || !layouts['_' + layout]) layout = 'default' if (!layout || !(layouts['_' + layout] || resolvedLayouts['_' + layout])) layout = 'default'
let _layout = '_' + layout let _layout = '_' + layout
if (resolvedLayouts[_layout]) { if (resolvedLayouts[_layout]) {
return Promise.resolve(resolvedLayouts[_layout]) return Promise.resolve(resolvedLayouts[_layout])