@mpxjs/core 2.6.98 → 2.7.0-alpha.0
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 +1 -0
- package/package.json +2 -2
- package/src/convertor/wxToTt.js +0 -8
- package/src/core/transferOptions.js +4 -0
- package/src/helper/MpxScroll/index.js +1 -7
- package/src/index.js +2 -1
- package/src/observer/scheduler.js +4 -4
- package/src/platform/builtInMixins/refsMixin.web.js +1 -1
- package/src/runtime/createFactory.js +2 -2
- package/src/runtime/mpx.js +1 -3
package/@types/index.d.ts
CHANGED
|
@@ -304,6 +304,7 @@ 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
308
|
}
|
|
308
309
|
|
|
309
310
|
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.
|
|
3
|
+
"version": "2.7.0-alpha.0",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"url": "https://github.com/didi/mpx/issues"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "43fe072e744b33b841b8e396677711e414bcca8b"
|
|
44
44
|
}
|
package/src/convertor/wxToTt.js
CHANGED
|
@@ -10,13 +10,5 @@ export default {
|
|
|
10
10
|
}
|
|
11
11
|
})
|
|
12
12
|
}
|
|
13
|
-
if (options.pageLifetimes && options.pageLifetimes.resize) {
|
|
14
|
-
error(`Options.pageLifetimes.resize is not supported in tt environment!`, global.currentResource)
|
|
15
|
-
delete options.pageLifetimes.resize
|
|
16
|
-
}
|
|
17
|
-
if (options.onResize) {
|
|
18
|
-
error(`Options.onResize is not supported in tt environment!`, global.currentResource)
|
|
19
|
-
delete options.onResize
|
|
20
|
-
}
|
|
21
13
|
}
|
|
22
14
|
}
|
|
@@ -19,6 +19,10 @@ export default function transferOptions (options, type, builtInMixins = []) {
|
|
|
19
19
|
// 编译计算属性注入
|
|
20
20
|
options.computed = Object.assign({}, options.computed, currentInject.injectComputed)
|
|
21
21
|
}
|
|
22
|
+
if (currentInject && currentInject.injectOptions) {
|
|
23
|
+
// 编译option注入,优先微信中的单独配置
|
|
24
|
+
options.options = Object.assign({}, currentInject.injectOptions, options.options)
|
|
25
|
+
}
|
|
22
26
|
// 转换mode
|
|
23
27
|
options.mpxConvertMode = options.mpxConvertMode || getConvertMode(global.currentSrcMode)
|
|
24
28
|
const rawOptions = mergeOptions(options, type)
|
|
@@ -196,13 +196,7 @@ export default class MpxScroll {
|
|
|
196
196
|
)
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
pageScrollTo (
|
|
200
|
-
{
|
|
201
|
-
scrollTop,
|
|
202
|
-
selector,
|
|
203
|
-
duration = 300
|
|
204
|
-
}
|
|
205
|
-
) {
|
|
199
|
+
pageScrollTo ({ scrollTop, selector, duration = 300 }) {
|
|
206
200
|
let _scrollTop
|
|
207
201
|
|
|
208
202
|
if (isDef(scrollTop)) {
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { asyncLock } from '../helper/utils'
|
|
2
2
|
import { error } from '../helper/log'
|
|
3
|
+
import EXPORT_MPX from '../index'
|
|
3
4
|
|
|
4
5
|
const queue = []
|
|
5
6
|
let has = {}
|
|
@@ -16,6 +17,8 @@ export function queueWatcher (watcher) {
|
|
|
16
17
|
run: watcher
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
// 开启EXPORT_MPX.config.forceRunWatcherSync时,queueWatcher同步执行,便于调试排查问题
|
|
21
|
+
if (EXPORT_MPX.config.forceRunWatcherSync) return watcher.run()
|
|
19
22
|
if (!has[watcher.id] || watcher.id === Infinity) {
|
|
20
23
|
has[watcher.id] = true
|
|
21
24
|
if (!flushing) {
|
|
@@ -57,10 +60,7 @@ function flushQueue () {
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
if (!watcher.destroyed) {
|
|
62
|
-
watcher.run()
|
|
63
|
-
}
|
|
63
|
+
watcher.run()
|
|
64
64
|
}
|
|
65
65
|
resetQueue()
|
|
66
66
|
}
|
|
@@ -244,7 +244,7 @@ class NodesRef {
|
|
|
244
244
|
function getIdentifier (vnode) {
|
|
245
245
|
let identifier = ''
|
|
246
246
|
if (vnode && vnode.data) {
|
|
247
|
-
if (vnode.data.attrs.id) identifier += `#${vnode.data.attrs.id}`
|
|
247
|
+
if (vnode.data.attrs && vnode.data.attrs.id) identifier += `#${vnode.data.attrs.id}`
|
|
248
248
|
if (vnode.data.staticClass) identifier += `.${vnode.data.staticClass.split(' ').join('.')}`
|
|
249
249
|
}
|
|
250
250
|
return identifier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const mpx = require('../index').default
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module.exports = (type) => (...args) => {
|
|
4
4
|
if (type === 'Behavior') {
|
|
5
5
|
if (args[0]) {
|
|
6
6
|
Object.defineProperty(args[0], '__mpx_behaviors_to_mixins__', {
|
package/src/runtime/mpx.js
CHANGED