@mpxjs/core 2.8.52 → 2.8.54
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 +2 -2
- package/src/core/proxy.js +10 -5
- package/src/index.js +7 -1
- package/src/platform/export/index.web.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.54",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e39ad9b35cdb336f271f424dbfae9cf7688c8d0d"
|
|
51
51
|
}
|
package/src/core/proxy.js
CHANGED
|
@@ -26,7 +26,8 @@ import {
|
|
|
26
26
|
getFirstKey,
|
|
27
27
|
callWithErrorHandling,
|
|
28
28
|
warn,
|
|
29
|
-
error
|
|
29
|
+
error,
|
|
30
|
+
getEnvObj
|
|
30
31
|
} from '@mpxjs/utils'
|
|
31
32
|
import {
|
|
32
33
|
BEFORECREATE,
|
|
@@ -45,6 +46,8 @@ import {
|
|
|
45
46
|
|
|
46
47
|
let uid = 0
|
|
47
48
|
|
|
49
|
+
const envObj = getEnvObj()
|
|
50
|
+
|
|
48
51
|
class RenderTask {
|
|
49
52
|
resolved = false
|
|
50
53
|
|
|
@@ -235,14 +238,14 @@ export default class MpxProxy {
|
|
|
235
238
|
const setupResult = callWithErrorHandling(setup, this, 'setup function', [
|
|
236
239
|
this.props,
|
|
237
240
|
{
|
|
238
|
-
triggerEvent: this.target.triggerEvent.bind(this.target),
|
|
241
|
+
triggerEvent: this.target.triggerEvent ? this.target.triggerEvent.bind(this.target) : noop,
|
|
239
242
|
refs: this.target.$refs,
|
|
240
243
|
asyncRefs: this.target.$asyncRefs,
|
|
241
244
|
forceUpdate: this.forceUpdate.bind(this),
|
|
242
245
|
selectComponent: this.target.selectComponent.bind(this.target),
|
|
243
246
|
selectAllComponents: this.target.selectAllComponents.bind(this.target),
|
|
244
|
-
createSelectorQuery: this.target.createSelectorQuery.bind(this.target),
|
|
245
|
-
createIntersectionObserver: this.target.createIntersectionObserver.bind(this.target)
|
|
247
|
+
createSelectorQuery: this.target.createSelectorQuery ? this.target.createSelectorQuery.bind(this.target) : envObj.createSelectorQuery.bind(envObj),
|
|
248
|
+
createIntersectionObserver: this.target.createIntersectionObserver ? this.target.createIntersectionObserver.bind(this.target) : envObj.createIntersectionObserver.bind(envObj)
|
|
246
249
|
}
|
|
247
250
|
])
|
|
248
251
|
if (!isObject(setupResult)) {
|
|
@@ -604,7 +607,9 @@ export default class MpxProxy {
|
|
|
604
607
|
|
|
605
608
|
export let currentInstance = null
|
|
606
609
|
|
|
607
|
-
export const getCurrentInstance = () =>
|
|
610
|
+
export const getCurrentInstance = () => {
|
|
611
|
+
return currentInstance && { proxy: currentInstance?.target }
|
|
612
|
+
}
|
|
608
613
|
|
|
609
614
|
export const setCurrentInstance = (instance) => {
|
|
610
615
|
currentInstance = instance
|
package/src/index.js
CHANGED
|
@@ -135,7 +135,13 @@ Mpx.config = {
|
|
|
135
135
|
proxyEventHandler: null,
|
|
136
136
|
setDataHandler: null,
|
|
137
137
|
forceFlushSync: false,
|
|
138
|
-
webRouteConfig: {}
|
|
138
|
+
webRouteConfig: {},
|
|
139
|
+
/*
|
|
140
|
+
支持两个属性
|
|
141
|
+
hostWhitelists Array 类型 支持h5域名白名单安全校验
|
|
142
|
+
apiImplementations webview JSSDK接口 例如getlocation
|
|
143
|
+
*/
|
|
144
|
+
webviewConfig: {}
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
global.__mpx = Mpx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
effectScope as vueEffectScope,
|
|
3
|
-
getCurrentScope as
|
|
3
|
+
getCurrentScope as vueGetCurrentScope
|
|
4
4
|
onScopeDispose
|
|
5
5
|
} from 'vue'
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ const fixEffectScope = (scope) => {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const effectScope = (detached) => fixEffectScope(vueEffectScope(detached))
|
|
45
|
-
const getCurrentScope = () => fixEffectScope(
|
|
45
|
+
const getCurrentScope = () => fixEffectScope(vueGetCurrentScope())
|
|
46
46
|
|
|
47
47
|
export {
|
|
48
48
|
// effectScope
|