@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 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.6.98",
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": "c92623625bb16ba8d73c6795fbb36de34570ee51"
43
+ "gitHead": "43fe072e744b33b841b8e396677711e414bcca8b"
44
44
  }
@@ -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
@@ -204,7 +204,8 @@ EXPORT_MPX.config = {
204
204
  observeClassInstance: false,
205
205
  hookErrorHandler: null,
206
206
  proxyEventHandler: null,
207
- setDataHandler: null
207
+ setDataHandler: null,
208
+ forceRunWatcherSync: false
208
209
  }
209
210
 
210
211
  if (__mpx_mode__ === 'web') {
@@ -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
- import mpx from '../index'
1
+ const mpx = require('../index').default
2
2
 
3
- export default (type) => (...args) => {
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__', {
@@ -1,3 +1 @@
1
- import mpx from '../index'
2
-
3
- export default mpx
1
+ module.exports = require('../index').default