1- import devtoolPlugin from './plugins/devtool'
21import 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'
53import ModuleCollection from './module/module-collection'
4+ import { forEachValue , isObject , isPromise , assert } from './util'
5+ import { mapState , mapMutations , mapGetters , mapActions } from './helpers'
66
77let Vue // bind on install
88
@@ -54,7 +54,7 @@ class Store {
5454 }
5555
5656 get state ( ) {
57- return this . _vm . $data . state
57+ return this . _vm . _data . $$ state
5858 }
5959
6060 set state ( v ) {
@@ -127,7 +127,7 @@ class Store {
127127
128128 replaceState ( state ) {
129129 this . _withCommit ( ( ) => {
130- this . _vm . state = state
130+ this . _vm . _data . $$ state = state
131131 } )
132132 }
133133
@@ -198,7 +198,9 @@ function resetStoreVM (store, state, hot) {
198198 const silent = Vue . config . silent
199199 Vue . config . silent = true
200200 store . _vm = new Vue ( {
201- data : { state } ,
201+ data : {
202+ $$state : state
203+ } ,
202204 computed
203205 } )
204206 Vue . config . silent = silent
@@ -213,7 +215,7 @@ function resetStoreVM (store, state, hot) {
213215 // dispatch changes in all subscribed watchers
214216 // to force getter re-evaluation for hot reloading.
215217 store . _withCommit ( ( ) => {
216- oldVm . state = null
218+ oldVm . _data . $$ state = null
217219 } )
218220 }
219221 Vue . nextTick ( ( ) => oldVm . $destroy ( ) )
@@ -388,7 +390,7 @@ function registerGetter (store, type, rawGetter, local) {
388390}
389391
390392function enableStrictMode ( store ) {
391- store . _vm . $watch ( ' state' , ( ) => {
393+ store . _vm . $watch ( function ( ) { return this . _data . $$ state } , ( ) => {
392394 assert ( store . _committing , `Do not mutate vuex store state outside mutation handlers.` )
393395 } , { deep : true , sync : true } )
394396}
0 commit comments