mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-09 03:03:18 +00:00
Call store.replaceState when app is created
This commit is contained in:
parent
920e969da8
commit
b2b707ae71
@ -190,12 +190,6 @@ const NUXT = window.__NUXT__ || {}
|
||||
if (!NUXT) {
|
||||
throw new Error('[nuxt.js] cannot find the global variable __NUXT__, make sure the server is working.')
|
||||
}
|
||||
<% if (store) { %>
|
||||
// Replace store state
|
||||
if (NUXT.state) {
|
||||
store.replaceState(NUXT.state)
|
||||
}
|
||||
<% } %>
|
||||
// Get matched components
|
||||
const path = getLocation(router.options.base)
|
||||
const resolveComponents = flatMapComponents(router.match(path), (Component, _, match, key, index) => {
|
||||
@ -244,6 +238,12 @@ Promise.all(resolveComponents)
|
||||
window.onNuxtReady(_app)
|
||||
}
|
||||
}
|
||||
<% if (store) { %>
|
||||
// Replace store state
|
||||
if (NUXT.state) {
|
||||
store.replaceState(NUXT.state)
|
||||
}
|
||||
<% } %>
|
||||
_app.setTransition = _app.$options._nuxt.setTransition.bind(_app)
|
||||
if (Components.length) _app.setTransition(Components[0].options.transition)
|
||||
_app.error = _app.$options._nuxt.error.bind(_app)
|
||||
|
Loading…
Reference in New Issue
Block a user