@mpxjs/core 2.8.26 → 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.
|
|
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.
|
|
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": "
|
|
50
|
+
"gitHead": "8c7fa579da9c3e71908eb9bfb5833a7d9477505d"
|
|
51
51
|
}
|
package/src/core/mergeOptions.js
CHANGED
|
@@ -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) {
|
package/src/observer/watch.js
CHANGED
|
@@ -42,7 +42,7 @@ const processWatchOptionsCompat = (options) => {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function watch (source, cb, options = {}) {
|
|
45
|
-
let { immediate, deep, flush
|
|
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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CREATED, BEFORECREATE,
|
|
1
|
+
import { CREATED, BEFORECREATE, BEFOREUPDATE, UNMOUNTED } from '../../core/innerLifecycle'
|
|
2
2
|
import { noop, error, getEnvObj } from '@mpxjs/utils'
|
|
3
3
|
|
|
4
4
|
const envObj = getEnvObj()
|
|
@@ -38,9 +38,6 @@ export default function getRefsMixin () {
|
|
|
38
38
|
this.$asyncRefs = {}
|
|
39
39
|
this.__refCacheMap = new Map()
|
|
40
40
|
this.__asyncRefCacheMap = new Map()
|
|
41
|
-
},
|
|
42
|
-
[BEFOREMOUNT] () {
|
|
43
|
-
// 避免在create/attached阶段获取未初始化完成的子组件实例,初始化refs时机延后至beforeMount
|
|
44
41
|
this.__getRefs()
|
|
45
42
|
},
|
|
46
43
|
[BEFOREUPDATE] () {
|
|
@@ -102,6 +99,7 @@ export default function getRefsMixin () {
|
|
|
102
99
|
createSelectorQuery (...args) {
|
|
103
100
|
const selectorQuery = envObj.createSelectorQuery(...args)
|
|
104
101
|
const cbs = []
|
|
102
|
+
|
|
105
103
|
proxyMethods.forEach((name) => {
|
|
106
104
|
const originalMethod = selectorQuery[name]
|
|
107
105
|
selectorQuery[name] = function (cb = noop) {
|