|
@@ -129,6 +129,18 @@ export class Store {
|
|
|
this._setupModuleMutations(modules || this._modules)
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Replace entire state tree.
|
|
|
+ */
|
|
|
+
|
|
|
+ replaceState (newState) {
|
|
|
+ const state = this._vm._data
|
|
|
+ const clone = deepClone(newState)
|
|
|
+ Object.keys(clone).forEach(key => {
|
|
|
+ state[key] = clone[key]
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Attach sub state tree of each module to the root tree.
|
|
|
*
|