@mpxjs/core 2.8.27 → 2.8.28-beta.11

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
@@ -128,6 +128,8 @@ interface ComponentOpt<D, P, C, M, Mi extends Array<any>, S extends Record<any,
128
128
 
129
129
  pageHide?: () => void
130
130
 
131
+ initData?: Record<string, any>
132
+
131
133
  [index: string]: any
132
134
  }
133
135
 
@@ -484,6 +486,8 @@ export function reactive<T extends object> (target: T): Reactive<T>
484
486
 
485
487
  export function isReactive (value: unknown): boolean
486
488
 
489
+ export function markRaw<T extends object>(value: T): T
490
+
487
491
  export function shallowReactive<T extends object> (target: T): ShallowReactive<T>
488
492
 
489
493
  export function computed<T> (
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.27",
3
+ "version": "2.8.28-beta.11",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
7
7
  "mpx"
8
8
  ],
9
9
  "author": "donghongping",
10
- "license": "Apache",
10
+ "license": "Apache-2.0",
11
11
  "module": "src/index.js",
12
12
  "types": "@types/index.d.ts",
13
13
  "directories": {
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "main": "src/index.js",
21
21
  "dependencies": {
22
- "@mpxjs/utils": "^2.8.15",
22
+ "@mpxjs/utils": "^2.8.28-beta.11",
23
23
  "lodash": "^4.1.1",
24
24
  "miniprogram-api-typings": "^3.0.2"
25
25
  },
@@ -47,5 +47,5 @@
47
47
  "url": "https://github.com/didi/mpx/issues"
48
48
  },
49
49
  "sideEffects": false,
50
- "gitHead": "f5b31d1f4f7602f103e5757f910f267d46bb91b1"
50
+ "gitHead": "8c7fa579da9c3e71908eb9bfb5833a7d9477505d"
51
51
  }
@@ -132,7 +132,9 @@ function extractObservers (options) {
132
132
  },
133
133
  deep: true,
134
134
  // 延迟触发首次回调,处理转换支付宝时在observer中查询组件的行为,如vant/picker中,如不考虑该特殊情形可用immediate代替
135
- immediateAsync: true
135
+ // immediateAsync: true
136
+ // 为了数据响应的标准化,不再提供immediateAsync选项,之前处理vant等原生组件跨平台转换遇到的问题推荐使用条件编译patch进行处理
137
+ immediate: true
136
138
  })
137
139
  }
138
140
  })
@@ -174,7 +176,9 @@ function extractObservers (options) {
174
176
  }
175
177
  },
176
178
  deep,
177
- immediateAsync: watchProp
179
+ // immediateAsync: watchProp
180
+ // 为了数据响应的标准化,不再提供immediateAsync选项,之前处理vant等原生组件跨平台转换遇到的问题推荐使用条件编译patch进行处理
181
+ immediate: watchProp
178
182
  })
179
183
  }
180
184
  })
package/src/core/proxy.js CHANGED
@@ -183,6 +183,7 @@ export default class MpxProxy {
183
183
  unmounted () {
184
184
  this.callHook(BEFOREUNMOUNT)
185
185
  this.scope?.stop()
186
+ if (this.update) this.update.active = false
186
187
  this.callHook(UNMOUNTED)
187
188
  this.state = UNMOUNTED
188
189
  }
@@ -409,6 +410,7 @@ export default class MpxProxy {
409
410
  }
410
411
  const subPath = aIsSubPathOfB(key, tarKey)
411
412
  if (subPath) {
413
+ if (!this.miniRenderData[tarKey]) this.miniRenderData[tarKey] = {}
412
414
  // setByPath 更新miniRenderData中的子数据
413
415
  doGetByPath(this.miniRenderData[tarKey], subPath, (current, subKey, meta) => {
414
416
  if (meta.isEnd) {
@@ -105,10 +105,10 @@ export class ReactiveEffect {
105
105
  this.pausedState = PausedState.paused
106
106
  }
107
107
 
108
- resume () {
108
+ resume (ignoreDirty = false) {
109
109
  const lastPausedState = this.pausedState
110
110
  this.pausedState = PausedState.resumed
111
- if (lastPausedState === PausedState.dirty) {
111
+ if (!ignoreDirty && lastPausedState === PausedState.dirty) {
112
112
  this.scheduler ? this.scheduler() : this.run()
113
113
  }
114
114
  }
@@ -73,15 +73,15 @@ class EffectScope {
73
73
  }
74
74
  }
75
75
 
76
- resume () {
76
+ resume (ignoreDirty = false) {
77
77
  if (this.active) {
78
78
  let i, l
79
79
  for (i = 0, l = this.effects.length; i < l; i++) {
80
- this.effects[i].resume()
80
+ this.effects[i].resume(ignoreDirty)
81
81
  }
82
82
  if (this.scopes) {
83
83
  for (i = 0, l = this.scopes.length; i < l; i++) {
84
- this.scopes[i].resume()
84
+ this.scopes[i].resume(ignoreDirty)
85
85
  }
86
86
  }
87
87
  }
@@ -42,7 +42,7 @@ const processWatchOptionsCompat = (options) => {
42
42
  }
43
43
 
44
44
  export function watch (source, cb, options = {}) {
45
- let { immediate, deep, flush, immediateAsync } = processWatchOptionsCompat(options)
45
+ let { immediate, deep, flush } = processWatchOptionsCompat(options)
46
46
  const instance = currentInstance
47
47
  let getter
48
48
  let isMultiSource = false
@@ -139,8 +139,6 @@ export function watch (source, cb, options = {}) {
139
139
  if (cb) {
140
140
  if (immediate) {
141
141
  job()
142
- } else if (immediateAsync) {
143
- queuePreFlushCb(job)
144
142
  } else {
145
143
  oldValue = effect.run()
146
144
  }
@@ -99,6 +99,7 @@ export default function getRefsMixin () {
99
99
  createSelectorQuery (...args) {
100
100
  const selectorQuery = envObj.createSelectorQuery(...args)
101
101
  const cbs = []
102
+
102
103
  proxyMethods.forEach((name) => {
103
104
  const originalMethod = selectorQuery[name]
104
105
  selectorQuery[name] = function (cb = noop) {
@@ -38,6 +38,7 @@ const noop = () => {
38
38
  const fixEffectScope = (scope) => {
39
39
  scope.pause = noop
40
40
  scope.resume = noop
41
+ return scope
41
42
  }
42
43
 
43
44
  const effectScope = (detached) => fixEffectScope(vueEffectScope(detached))