@mpxjs/core 2.7.52 → 2.8.0-beta.2
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 +342 -27
- package/package.json +10 -5
- package/src/convertor/convertor.js +2 -2
- package/src/convertor/mergeLifecycle.js +4 -4
- package/src/convertor/wxToAli.js +3 -4
- package/src/convertor/wxToSwan.js +2 -2
- package/src/convertor/wxToTt.js +1 -10
- package/src/convertor/wxToWeb.js +14 -7
- package/src/core/implement.js +2 -2
- package/src/core/injectMixins.js +1 -1
- package/src/core/innerLifecycle.js +15 -2
- package/src/core/mergeOptions.js +11 -5
- package/src/core/proxy.js +343 -229
- package/src/core/transferOptions.js +5 -2
- package/src/helper/const.js +10 -0
- package/src/index.js +73 -147
- package/src/observer/array.js +12 -17
- package/src/observer/computed.js +27 -56
- package/src/observer/dep.js +1 -1
- package/src/observer/effect.js +113 -0
- package/src/observer/effectScope.js +109 -0
- package/src/observer/{index.js → reactive.js} +74 -70
- package/src/observer/ref.js +97 -0
- package/src/observer/scheduler.js +171 -56
- package/src/observer/watch.js +163 -39
- package/src/platform/builtInMixins/i18nMixin.js +238 -31
- package/src/platform/builtInMixins/pageScrollMixin.web.js +4 -5
- package/src/platform/builtInMixins/pageStatusMixin.js +76 -54
- package/src/platform/builtInMixins/pageStatusMixin.web.js +35 -22
- package/src/platform/builtInMixins/proxyEventMixin.js +40 -22
- package/src/platform/builtInMixins/proxyEventMixin.web.js +16 -24
- package/src/platform/builtInMixins/refsMixin.js +82 -73
- package/src/platform/builtInMixins/refsMixin.web.js +0 -47
- package/src/platform/builtInMixins/relationsMixin.js +10 -9
- package/src/platform/builtInMixins/renderHelperMixin.js +1 -1
- package/src/platform/builtInMixins/showMixin.js +1 -1
- package/src/platform/createApp.js +5 -5
- package/src/platform/export/api.js +23 -0
- package/src/platform/export/api.web.js +26 -0
- package/src/platform/export/index.js +45 -0
- package/src/platform/export/index.web.js +36 -0
- package/src/platform/index.js +1 -5
- package/src/platform/patch/ali/getDefaultOptions.js +33 -31
- package/src/platform/patch/ali/lifecycle.js +21 -13
- package/src/platform/patch/builtInKeysMap.js +2 -1
- package/src/platform/patch/index.js +4 -9
- package/src/platform/patch/swan/getDefaultOptions.js +3 -3
- package/src/platform/patch/swan/lifecycle.js +17 -14
- package/src/platform/patch/web/getDefaultOptions.js +40 -16
- package/src/platform/patch/web/lifecycle.js +6 -3
- package/src/platform/patch/wx/getDefaultOptions.js +38 -31
- package/src/platform/patch/wx/lifecycle.js +18 -11
- package/src/runtime/createFactory.js +6 -2
- package/src/vue.web.js +3 -0
- package/src/vuePlugin.js +31 -0
- package/src/core/createStore.js +0 -241
- package/src/core/mapStore.js +0 -94
- package/src/helper/env.js +0 -20
- package/src/helper/getByPath.js +0 -127
- package/src/helper/log.js +0 -31
- package/src/helper/utils.js +0 -652
- package/src/observer/watcher.js +0 -244
package/src/core/mergeOptions.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { isObject, aliasReplace, findItem, makeMap } from '../helper/utils'
|
|
2
1
|
import { getConvertRule } from '../convertor/convertor'
|
|
3
|
-
import { error, warn } from '../helper/log'
|
|
4
2
|
import builtInKeysMap from '../platform/patch/builtInKeysMap'
|
|
5
3
|
import { implemented } from './implement'
|
|
4
|
+
import {
|
|
5
|
+
isObject,
|
|
6
|
+
aliasReplace,
|
|
7
|
+
makeMap,
|
|
8
|
+
findItem,
|
|
9
|
+
error,
|
|
10
|
+
warn
|
|
11
|
+
} from '@mpxjs/utils'
|
|
6
12
|
|
|
7
13
|
let currentHooksMap = {}
|
|
8
14
|
let curType
|
|
@@ -203,7 +209,7 @@ function extractPageHooks (options) {
|
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
function mergeMixins (parent, child) {
|
|
206
|
-
for (
|
|
212
|
+
for (const key in child) {
|
|
207
213
|
if (currentHooksMap[key]) {
|
|
208
214
|
mergeHooks(parent, child, key)
|
|
209
215
|
} else if (/^(data|dataFn)$/.test(key)) {
|
|
@@ -247,7 +253,7 @@ export function mergeShallowObj (parent, child, key) {
|
|
|
247
253
|
|
|
248
254
|
function mergeDataFn (parent, child, key) {
|
|
249
255
|
let parentVal = parent[key]
|
|
250
|
-
|
|
256
|
+
const childVal = child[key]
|
|
251
257
|
|
|
252
258
|
if (typeof parentVal === 'function' && key === 'data') {
|
|
253
259
|
parent.dataFn = parentVal
|
|
@@ -345,7 +351,7 @@ function transformHOOKS (options) {
|
|
|
345
351
|
const componentHooksMap = makeMap(convertRule.lifecycle.component)
|
|
346
352
|
for (const key in options) {
|
|
347
353
|
// 使用Component创建page实例,页面专属生命周期&自定义方法需写在methods内部
|
|
348
|
-
if (typeof options[key] === 'function' && key !== 'dataFn' && !componentHooksMap[key]) {
|
|
354
|
+
if (typeof options[key] === 'function' && key !== 'dataFn' && key !== 'setup' && !componentHooksMap[key]) {
|
|
349
355
|
if (!options.methods) options.methods = {}
|
|
350
356
|
options.methods[key] = options[key]
|
|
351
357
|
delete options[key]
|