1
- import devtoolPlugin from './plugins/devtool'
2
1
import applyMixin from './mixin'
3
- import { mapState , mapMutations , mapGetters , mapActions } from './helpers'
4
- import { forEachValue , isObject , isPromise , assert } from './util'
2
+ import devtoolPlugin from './plugins/devtool'
5
3
import ModuleCollection from './module/module-collection'
4
+ import { forEachValue , isObject , isPromise , assert } from './util'
5
+ import { mapState , mapMutations , mapGetters , mapActions } from './helpers'
6
6
7
7
let Vue // bind on install
8
8
@@ -54,7 +54,7 @@ class Store {
54
54
}
55
55
56
56
get state ( ) {
57
- return this . _vm . $data . state
57
+ return this . _vm . _data . $$ state
58
58
}
59
59
60
60
set state ( v ) {
@@ -127,7 +127,7 @@ class Store {
127
127
128
128
replaceState ( state ) {
129
129
this . _withCommit ( ( ) => {
130
- this . _vm . state = state
130
+ this . _vm . _data . $$ state = state
131
131
} )
132
132
}
133
133
@@ -198,7 +198,9 @@ function resetStoreVM (store, state, hot) {
198
198
const silent = Vue . config . silent
199
199
Vue . config . silent = true
200
200
store . _vm = new Vue ( {
201
- data : { state } ,
201
+ data : {
202
+ $$state : state
203
+ } ,
202
204
computed
203
205
} )
204
206
Vue . config . silent = silent
@@ -213,7 +215,7 @@ function resetStoreVM (store, state, hot) {
213
215
// dispatch changes in all subscribed watchers
214
216
// to force getter re-evaluation for hot reloading.
215
217
store . _withCommit ( ( ) => {
216
- oldVm . state = null
218
+ oldVm . _data . $$ state = null
217
219
} )
218
220
}
219
221
Vue . nextTick ( ( ) => oldVm . $destroy ( ) )
@@ -388,7 +390,7 @@ function registerGetter (store, type, rawGetter, local) {
388
390
}
389
391
390
392
function enableStrictMode ( store ) {
391
- store . _vm . $watch ( ' state' , ( ) => {
393
+ store . _vm . $watch ( function ( ) { return this . _data . $$ state } , ( ) => {
392
394
assert ( store . _committing , `Do not mutate vuex store state outside mutation handlers.` )
393
395
} , { deep : true , sync : true } )
394
396
}
0 commit comments