mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Call store.replaceState on start
This commit is contained in:
parent
cfd6b197c4
commit
474f68e46e
@ -336,6 +336,12 @@ const NUXT = window.__NUXT__ || {}
|
|||||||
if (!NUXT) {
|
if (!NUXT) {
|
||||||
throw new Error('[nuxt.js] cannot find the global variable __NUXT__, make sure the server is working.')
|
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
|
// Get matched components
|
||||||
const path = getLocation(router.options.base)
|
const path = getLocation(router.options.base)
|
||||||
const resolveComponents = flatMapComponents(router.match(path), (Component, _, match, key, index) => {
|
const resolveComponents = flatMapComponents(router.match(path), (Component, _, match, key, index) => {
|
||||||
@ -411,12 +417,6 @@ Promise.all(resolveComponents)
|
|||||||
nuxtReady(_app)
|
nuxtReady(_app)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<% if (store) { %>
|
|
||||||
// Replace store state
|
|
||||||
if (NUXT.state) {
|
|
||||||
store.replaceState(NUXT.state)
|
|
||||||
}
|
|
||||||
<% } %>
|
|
||||||
_app.setTransitions = _app.$options._nuxt.setTransitions.bind(_app)
|
_app.setTransitions = _app.$options._nuxt.setTransitions.bind(_app)
|
||||||
if (Components.length) {
|
if (Components.length) {
|
||||||
_app.setTransitions(mapTransitions(Components, router.currentRoute))
|
_app.setTransitions(mapTransitions(Components, router.currentRoute))
|
||||||
|
Loading…
Reference in New Issue
Block a user