@mpxjs/core 2.10.5 → 2.10.6
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/@types/node.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"main": "src/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mpxjs/utils": "^2.10.
|
|
22
|
+
"@mpxjs/utils": "^2.10.6",
|
|
23
23
|
"lodash": "^4.1.1",
|
|
24
24
|
"miniprogram-api-typings": "^3.10.0"
|
|
25
25
|
},
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"url": "https://github.com/didi/mpx/issues"
|
|
110
110
|
},
|
|
111
111
|
"sideEffects": false,
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "e28605bc2d8ab33f4dccf13ea98d9ca996f43ed6"
|
|
113
113
|
}
|
|
@@ -273,13 +273,6 @@ export default function createApp (options) {
|
|
|
273
273
|
return []
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
global.setCurrentPageStatus = function (status) {
|
|
277
|
-
const navigation = getFocusedNavigation()
|
|
278
|
-
if (navigation && hasOwn(global.__mpxPageStatusMap, navigation.pageId)) {
|
|
279
|
-
global.__mpxPageStatusMap[navigation.pageId] = status
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
276
|
// 用于外层业务用来设置App的展示情况
|
|
284
277
|
global.setAppShow = function () {
|
|
285
278
|
onAppStateChange('active')
|
|
@@ -3,6 +3,8 @@ import { createI18n } from '../builtInMixins/i18nMixin'
|
|
|
3
3
|
import * as navigationHelper from './navigationHelper'
|
|
4
4
|
|
|
5
5
|
export function init (Mpx) {
|
|
6
|
+
// 为避免多个mpx应用运行时互相覆盖global __mpx对象,导致业务异常,例如插件模式下,插件应用和业务应用互相覆盖global.__mpx,因此创建mpxGlobal局部对象
|
|
7
|
+
mpxGlobal.__mpx = Mpx
|
|
6
8
|
global.__mpx = Mpx
|
|
7
9
|
global.__mpxAppCbs = global.__mpxAppCbs || {
|
|
8
10
|
show: [],
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createI18n } from '../builtInMixins/i18nMixin'
|
|
2
2
|
|
|
3
3
|
export function init (Mpx) {
|
|
4
|
+
// 为避免多个mpx应用运行时互相覆盖global __mpx对象,导致业务异常,例如插件模式下,插件应用和业务应用互相覆盖global.__mpx,因此创建mpxGlobal局部对象
|
|
5
|
+
mpxGlobal.__mpx = Mpx
|
|
4
6
|
global.__mpx = Mpx
|
|
5
7
|
if (global.i18n) {
|
|
6
8
|
Mpx.i18n = createI18n(global.i18n)
|
|
@@ -4,6 +4,8 @@ import { isBrowser, error, warn } from '@mpxjs/utils'
|
|
|
4
4
|
import { initEvent } from './event'
|
|
5
5
|
|
|
6
6
|
export function init (Mpx) {
|
|
7
|
+
// 为避免多个mpx应用运行时互相覆盖global __mpx对象,导致业务异常,例如插件模式下,插件应用和业务应用互相覆盖global.__mpx,因此创建mpxGlobal局部对象
|
|
8
|
+
mpxGlobal.__mpx = Mpx
|
|
7
9
|
global.__mpx = Mpx
|
|
8
10
|
global.__mpxAppCbs = global.__mpxAppCbs || {
|
|
9
11
|
show: [],
|
|
@@ -51,7 +51,7 @@ function createEffect (proxy, components) {
|
|
|
51
51
|
if (tagName === 'block') return Fragment
|
|
52
52
|
const appComponents = global.__getAppComponents?.() || {}
|
|
53
53
|
const generichash = proxy.target.generichash || ''
|
|
54
|
-
const genericComponents = global.__mpxGenericsMap[generichash] || noop
|
|
54
|
+
const genericComponents = global.__mpxGenericsMap?.[generichash] || noop
|
|
55
55
|
return components[tagName] || genericComponents(tagName) || appComponents[tagName] || getByPath(ReactNative, tagName)
|
|
56
56
|
}
|
|
57
57
|
const innerCreateElement = (type, ...rest) => {
|
|
@@ -302,15 +302,8 @@ function createInstance ({ propsRef, type, rawOptions, currentInject, validProps
|
|
|
302
302
|
proxy.created()
|
|
303
303
|
|
|
304
304
|
if (type === 'page') {
|
|
305
|
-
const loadParams = {}
|
|
306
305
|
const props = propsRef.current
|
|
307
|
-
|
|
308
|
-
if (isObject(props.route.params)) {
|
|
309
|
-
for (const key in props.route.params) {
|
|
310
|
-
loadParams[key] = encodeURIComponent(props.route.params[key])
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
proxy.callHook(ONLOAD, [loadParams])
|
|
306
|
+
proxy.callHook(ONLOAD, [props.route.params || {}])
|
|
314
307
|
}
|
|
315
308
|
|
|
316
309
|
Object.assign(proxy, {
|
|
@@ -467,16 +460,16 @@ export function PageWrapperHOC (WrappedComponent) {
|
|
|
467
460
|
usePageStatus(navigation, currentPageId)
|
|
468
461
|
useLayoutEffect(() => {
|
|
469
462
|
navigation.setOptions({
|
|
470
|
-
title:
|
|
463
|
+
title: currentPageConfig.navigationBarTitleText?.trim() || '',
|
|
471
464
|
headerStyle: {
|
|
472
|
-
backgroundColor:
|
|
465
|
+
backgroundColor: currentPageConfig.navigationBarBackgroundColor || '#000000'
|
|
473
466
|
},
|
|
474
|
-
headerTintColor:
|
|
467
|
+
headerTintColor: currentPageConfig.navigationBarTextStyle || 'white'
|
|
475
468
|
})
|
|
476
469
|
|
|
477
470
|
// TODO 此部分内容在native-stack可删除,用setOptions设置
|
|
478
471
|
if (__mpx_mode__ !== 'ios') {
|
|
479
|
-
ReactNative.StatusBar.setBarStyle(
|
|
472
|
+
ReactNative.StatusBar.setBarStyle(currentPageConfig.barStyle || 'dark-content')
|
|
480
473
|
ReactNative.StatusBar.setTranslucent(true) // 控制statusbar是否占位
|
|
481
474
|
ReactNative.StatusBar.setBackgroundColor('transparent')
|
|
482
475
|
}
|