@mpxjs/store 2.8.23-alpha → 2.8.28-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/index.js +3 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/store",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.28-beta.11",
|
|
4
4
|
"description": "A store for mpx framework",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"store"
|
|
17
17
|
],
|
|
18
18
|
"author": "donghongping",
|
|
19
|
-
"license": "
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/didi/mpx/issues"
|
|
22
22
|
},
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/didi/mpx#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mpxjs/utils": "^2.8.
|
|
29
|
+
"@mpxjs/utils": "^2.8.28-beta.11"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@mpxjs/core": "^2.8.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8c7fa579da9c3e71908eb9bfb5833a7d9477505d"
|
|
35
35
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import Mpx, { reactive, computed } from '@mpxjs/core'
|
|
2
|
-
import Vue from '../vue'
|
|
3
|
-
import createHummerPlugin from '../platform/builtInPlugins/hummerStorePlugin'
|
|
4
2
|
import {
|
|
5
3
|
getByPath,
|
|
6
4
|
warn,
|
|
@@ -120,12 +118,6 @@ class Store {
|
|
|
120
118
|
this.state = this.registerModule(options).state
|
|
121
119
|
this.resetStoreVM()
|
|
122
120
|
Object.assign(this, mapStore(this))
|
|
123
|
-
if (__mpx_mode__ === 'tenon') {
|
|
124
|
-
plugins.push(createHummerPlugin({
|
|
125
|
-
/* eslint-disable camelcase */
|
|
126
|
-
store_key: `MPX_STORE${options.__store_id}`
|
|
127
|
-
}))
|
|
128
|
-
}
|
|
129
121
|
plugins.forEach(plugin => plugin(this))
|
|
130
122
|
}
|
|
131
123
|
|
|
@@ -154,9 +146,9 @@ class Store {
|
|
|
154
146
|
|
|
155
147
|
registerModule (module) {
|
|
156
148
|
const state = module.state || {}
|
|
157
|
-
const reactiveModule =
|
|
158
|
-
|
|
159
|
-
|
|
149
|
+
const reactiveModule = {
|
|
150
|
+
state
|
|
151
|
+
}
|
|
160
152
|
if (module.getters) {
|
|
161
153
|
reactiveModule.getters = transformGetters(module.getters, reactiveModule, this)
|
|
162
154
|
}
|
|
@@ -197,16 +189,6 @@ class Store {
|
|
|
197
189
|
const computedKeys = Object.keys(this.__wrappedGetters)
|
|
198
190
|
proxy(this.getters, vm, computedKeys)
|
|
199
191
|
proxy(this.getters, this.__depsGetters)
|
|
200
|
-
} else if (__mpx_mode__ === 'tenon') {
|
|
201
|
-
const computedObj = {}
|
|
202
|
-
Object.keys(this.__wrappedGetters).forEach(k => {
|
|
203
|
-
const getter = this.__wrappedGetters[k]
|
|
204
|
-
computedObj[k] = () => getter(this.state)
|
|
205
|
-
Object.defineProperty(this.getters, k, {
|
|
206
|
-
get: () => computedObj[k](),
|
|
207
|
-
enumerable: true // for local getters
|
|
208
|
-
})
|
|
209
|
-
})
|
|
210
192
|
} else {
|
|
211
193
|
reactive(this.state)
|
|
212
194
|
const computedObj = {}
|
|
@@ -217,19 +199,6 @@ class Store {
|
|
|
217
199
|
proxy(this.getters, this.__depsGetters)
|
|
218
200
|
}
|
|
219
201
|
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* 替换state,tenon环境中使用
|
|
223
|
-
*/
|
|
224
|
-
replaceState (state) {
|
|
225
|
-
// todo 某些key可能无法删除
|
|
226
|
-
Object.assign(this.state, state)
|
|
227
|
-
// this.resetStoreVM()
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
_withCommit (fn) {
|
|
231
|
-
fn()
|
|
232
|
-
}
|
|
233
202
|
}
|
|
234
203
|
|
|
235
204
|
function genericSubscribe (fn, subs, options) {
|