mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
refactor client.js createApp using async/await
This commit is contained in:
parent
ae0c88acbf
commit
a58b85a238
@ -356,23 +356,15 @@ function nuxtReady (app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createApp()
|
createApp()
|
||||||
.then((__app) => {
|
.then(async (__app) => {
|
||||||
app = __app.app
|
app = __app.app
|
||||||
router = __app.router
|
router = __app.router
|
||||||
<%= (store ? 'store = __app.store' : '') %>
|
<%= (store ? 'store = __app.store' : '') %>
|
||||||
return Promise.all(resolveComponents(router))
|
const Components = await Promise.all(resolveComponents(router))
|
||||||
})
|
|
||||||
.then((Components) => {
|
|
||||||
const _app = new Vue(app)
|
const _app = new Vue(app)
|
||||||
|
const layout = NUXT.layout || 'default'
|
||||||
let layout = NUXT.layout || 'default'
|
await _app.loadLayout(layout)
|
||||||
return _app.loadLayout(layout)
|
_app.setLayout(layout)
|
||||||
.then(() => {
|
|
||||||
_app.setLayout(layout)
|
|
||||||
return { _app, Components }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.then(({ _app, Components }) => {
|
|
||||||
const mountApp = () => {
|
const mountApp = () => {
|
||||||
_app.$mount('#__nuxt')
|
_app.$mount('#__nuxt')
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user