@mpxjs/core 2.7.0-beta.5 → 2.7.1-beta.1
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/index.d.ts
CHANGED
|
@@ -304,7 +304,8 @@ interface MpxConfig {
|
|
|
304
304
|
hookErrorHandler: (e: Error, target: ComponentIns<{}, {}, {}, {}, []>, hookName: string) => any | null
|
|
305
305
|
proxyEventHandler: (e: Event) => any | null
|
|
306
306
|
setDataHandler: (data: object, target: ComponentIns<{}, {}, {}, {}, []>) => any | null
|
|
307
|
-
forceRunWatcherSync: boolean
|
|
307
|
+
forceRunWatcherSync: boolean,
|
|
308
|
+
webRouteConfig: object
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
type SupportedMode = 'wx' | 'ali' | 'qq' | 'swan' | 'tt' | 'web' | 'qa'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1-beta.1",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"src",
|
|
18
18
|
"@types"
|
|
19
19
|
],
|
|
20
|
+
"main": "src/index.js",
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"lodash": "^4.1.1",
|
|
22
23
|
"miniprogram-api-typings": "^3.0.2"
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"url": "https://github.com/didi/mpx/issues"
|
|
41
42
|
},
|
|
42
43
|
"sideEffects": false,
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "0ea8bcfff2ccfc433cb2ce43275b7e2af2bc8a61"
|
|
44
45
|
}
|
package/src/index.js
CHANGED
|
@@ -205,12 +205,13 @@ EXPORT_MPX.config = {
|
|
|
205
205
|
hookErrorHandler: null,
|
|
206
206
|
proxyEventHandler: null,
|
|
207
207
|
setDataHandler: null,
|
|
208
|
-
forceRunWatcherSync: false
|
|
208
|
+
forceRunWatcherSync: false,
|
|
209
|
+
webRouteConfig: {}
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
global.__mpx = EXPORT_MPX
|
|
213
|
+
|
|
214
|
+
if (__mpx_mode__ !== 'web') {
|
|
214
215
|
if (global.i18n) {
|
|
215
216
|
observe(global.i18n)
|
|
216
217
|
// 挂载翻译方法
|
|
@@ -3,9 +3,7 @@ export default function pageRouteMixin (mixinType) {
|
|
|
3
3
|
if (mixinType === 'page') {
|
|
4
4
|
return {
|
|
5
5
|
beforeCreate () {
|
|
6
|
-
|
|
7
|
-
this.route = this.$options.__mpxPageRoute.slice(1)
|
|
8
|
-
}
|
|
6
|
+
this.route = this.$options.__mpxPageRoute || ''
|
|
9
7
|
}
|
|
10
8
|
}
|
|
11
9
|
}
|
|
@@ -20,6 +20,8 @@ export default function proxyEventMixin () {
|
|
|
20
20
|
if (type === 'begin' || type === 'end') {
|
|
21
21
|
// 地图的 regionchange 事件会派发 e.type 为 begin 和 end 的事件
|
|
22
22
|
fallbackType = 'regionchange'
|
|
23
|
+
} else if (__mpx_mode__ === 'ali') {
|
|
24
|
+
fallbackType = type.replace(/^./, i => i.toLowerCase())
|
|
23
25
|
}
|
|
24
26
|
const target = $event.currentTarget || $event.target
|
|
25
27
|
if (!target) {
|
|
@@ -3,6 +3,7 @@ import mergeOptions from '../core/mergeOptions'
|
|
|
3
3
|
import builtInKeysMap from './patch/builtInKeysMap'
|
|
4
4
|
import { makeMap, spreadProp } from '../helper/utils'
|
|
5
5
|
import * as webLifecycle from '../platform/patch/web/lifecycle'
|
|
6
|
+
import EXPORT_MPX from '../index'
|
|
6
7
|
|
|
7
8
|
const webAppHooksMap = makeMap(webLifecycle.LIFECYCLE.APP_HOOKS)
|
|
8
9
|
|
|
@@ -22,7 +23,12 @@ function filterOptions (options, appData) {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export default function createApp (option, config = {}) {
|
|
25
|
-
|
|
26
|
+
// 在App中挂载mpx对象供周边工具访问,如e2e测试
|
|
27
|
+
const builtInMixins = [{
|
|
28
|
+
getMpx () {
|
|
29
|
+
return EXPORT_MPX
|
|
30
|
+
}
|
|
31
|
+
}]
|
|
26
32
|
const appData = {}
|
|
27
33
|
if (__mpx_mode__ === 'web') {
|
|
28
34
|
builtInMixins.push({
|