refactor client.js createApp using async/await

This commit is contained in:
Pooya Parsa 2017-05-26 16:11:18 +04:30
parent ae0c88acbf
commit a58b85a238

View File

@ -356,23 +356,15 @@ function nuxtReady (app) {
}
createApp()
.then((__app) => {
.then(async (__app) => {
app = __app.app
router = __app.router
<%= (store ? 'store = __app.store' : '') %>
return Promise.all(resolveComponents(router))
})
.then((Components) => {
const Components = await Promise.all(resolveComponents(router))
const _app = new Vue(app)
let layout = NUXT.layout || 'default'
return _app.loadLayout(layout)
.then(() => {
_app.setLayout(layout)
return { _app, Components }
})
})
.then(({ _app, Components }) => {
const layout = NUXT.layout || 'default'
await _app.loadLayout(layout)
_app.setLayout(layout)
const mountApp = () => {
_app.$mount('#__nuxt')
Vue.nextTick(() => {