-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Hi, recently I read the source code of the Vuex. When I read the function of “resetStoreVM”,I see the store._vm is used by the instance of the Vue and the store.state is used the getter to get the “this._vm._data.$$state”.but all the source nowhere use the feature of the VM. absolutely we can use the plain object like this:
get state () {
return this._state
}
function resetStoreVM (store, state, hot) {
const oldState = store._state
store.getters = {}
const wrappedGetters = store._wrappedGetters
forEachValue(wrappedGetters, (fn, key) => {
Object.defineProperty(store.getters, key, {
get: () => () => fn(store),
enumerable: true
})
})
store._state = state
}
Metadata
Metadata
Assignees
Labels
No labels