annil 1.0.1 → 1.0.5
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/CHANGELOG.md +19 -0
- package/README.md +105 -6
- package/dist/api/DefineComponent/ReturnType/test/normalComponentDoc.test.js +6 -6
- package/dist/api/DefineComponent/ReturnType/test/normalComponentDoc.test.js.map +1 -1
- package/dist/api/DefineComponent/ReturnType/test/normalPageDoc.test.js.map +1 -1
- package/dist/api/DefineComponent/collectOptionsForComponent.d.ts +4 -0
- package/dist/api/DefineComponent/collectOptionsForComponent.js +152 -0
- package/dist/api/DefineComponent/collectOptionsForComponent.js.map +1 -0
- package/dist/api/DefineComponent/index.d.ts +4 -28
- package/dist/api/DefineComponent/index.js +2 -37
- package/dist/api/DefineComponent/index.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +5 -4
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +5 -5
- package/dist/api/RootComponent/CustomEvents/test/error.test.js +8 -8
- package/dist/api/RootComponent/CustomEvents/test/error.test.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/test/normal.test.d.ts +17 -17
- package/dist/api/RootComponent/CustomEvents/test/normal.test.js +6 -6
- package/dist/api/RootComponent/CustomEvents/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Data/DataConstraint.d.ts +1 -0
- package/dist/api/RootComponent/Data/DataConstraint.js +2 -0
- package/dist/api/RootComponent/Data/DataConstraint.js.map +1 -0
- package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js +5 -5
- package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js.map +1 -1
- package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js +5 -5
- package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Instance/test/properties/mormal.test.js.map +1 -1
- package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +2 -2
- package/dist/api/RootComponent/Lifetimes/test/error.test.js +1 -0
- package/dist/api/RootComponent/Lifetimes/test/error.test.js.map +1 -1
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js +3 -0
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/PageLifetimes/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/GetOptionalDoc.d.ts +2 -2
- package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +2 -2
- package/dist/api/RootComponent/Properties/PropertiesConstraint.d.ts +6 -6
- package/dist/api/RootComponent/Properties/PropertiesValueValidator.d.ts +2 -2
- package/dist/api/RootComponent/Properties/test/error.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalOptional.test.js +15 -0
- package/dist/api/RootComponent/Properties/test/normalOptional.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalRequired.test.d.ts +21 -21
- package/dist/api/RootComponent/index.d.ts +19 -2
- package/dist/api/RootComponent/index.js +1 -1
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +1 -1
- package/dist/api/SubComponent/SubComputed/test/normal.test.js +4 -4
- package/dist/api/SubComponent/SubComputed/test/normal.test.js.map +1 -1
- package/dist/api/SubComponent/index.d.ts +2 -2
- package/dist/api/SubComponent/index.js.map +1 -1
- package/dist/api/navigateTo.d.ts +1 -1
- package/dist/{utils → behaviors/BComputedAndWatch}/computedUpdater.d.ts +1 -1
- package/dist/{utils → behaviors/BComputedAndWatch}/computedUpdater.js +2 -2
- package/dist/behaviors/BComputedAndWatch/computedUpdater.js.map +1 -0
- package/dist/{utils → behaviors/BComputedAndWatch}/getPathsValue.d.ts +1 -1
- package/dist/behaviors/BComputedAndWatch/getPathsValue.js.map +1 -0
- package/dist/behaviors/BComputedAndWatch/index.js +8 -1
- package/dist/behaviors/BComputedAndWatch/index.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/initComputed.js +1 -1
- package/dist/behaviors/BComputedAndWatch/initComputed.js.map +1 -1
- package/dist/behaviors/BStore.js.map +1 -1
- package/dist/behaviors/BbeforeCreated.js +1 -2
- package/dist/behaviors/BbeforeCreated.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/{SpecificType.d.ts → DetailedType.d.ts} +1 -1
- package/dist/types/DetailedType.js +2 -0
- package/dist/types/DetailedType.js.map +1 -0
- package/dist/types/GenerateDoc.d.ts +9 -0
- package/dist/types/GenerateDoc.js +2 -0
- package/dist/types/GenerateDoc.js.map +1 -0
- package/dist/types/InferDetailedType.d.ts +2 -0
- package/dist/types/InferDetailedType.js +2 -0
- package/dist/types/InferDetailedType.js.map +1 -0
- package/dist/types/{InferSpecificType.test.js → InferDetailedType.test.js} +1 -1
- package/dist/types/InferDetailedType.test.js.map +1 -0
- package/dist/types/OfficialTypeAlias.d.ts +6 -6
- package/package.json +3 -3
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +12 -12
- package/src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts +4 -4
- package/src/api/DefineComponent/collectOptionsForComponent.ts +290 -0
- package/src/api/DefineComponent/index.ts +12 -85
- package/src/api/RootComponent/Computed/test/normal.test.ts +2 -2
- package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +6 -4
- package/src/api/RootComponent/CustomEvents/CustomEventsOption.ts +2 -2
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +7 -7
- package/src/api/RootComponent/CustomEvents/test/error.test.ts +8 -8
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +9 -9
- package/src/api/RootComponent/Data/DataConstraint.ts +1 -0
- package/src/api/RootComponent/Events/EventsConstraint.ts +1 -1
- package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +8 -8
- package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +8 -8
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +3 -3
- package/src/api/RootComponent/IsPage/IsPageOption.ts +6 -1
- package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +2 -2
- package/src/api/RootComponent/Lifetimes/test/error.test.ts +1 -1
- package/src/api/RootComponent/Lifetimes/test/normal.test.ts +3 -3
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -3
- package/src/api/RootComponent/Properties/GetOptionalDoc.ts +5 -5
- package/src/api/RootComponent/Properties/GetRequiredDoc.ts +5 -5
- package/src/api/RootComponent/Properties/PropertiesConstraint.ts +6 -6
- package/src/api/RootComponent/Properties/PropertiesOption.ts +1 -1
- package/src/api/RootComponent/Properties/PropertiesValueValidator.ts +2 -2
- package/src/api/RootComponent/Properties/test/error.test.ts +2 -2
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +25 -5
- package/src/api/RootComponent/Properties/test/normalRequired.test.ts +11 -11
- package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +2 -2
- package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +4 -4
- package/src/api/RootComponent/index.ts +19 -3
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +15 -9
- package/src/api/SubComponent/index.ts +4 -4
- package/src/{utils → behaviors/BComputedAndWatch}/computedUpdater.ts +5 -4
- package/src/{utils → behaviors/BComputedAndWatch}/getPathsValue.ts +1 -1
- package/src/behaviors/BComputedAndWatch/index.ts +13 -4
- package/src/behaviors/BComputedAndWatch/initComputed.ts +1 -1
- package/src/behaviors/BStore.ts +2 -2
- package/src/behaviors/BbeforeCreated.ts +3 -3
- package/src/index.ts +11 -2
- package/src/types/DetailedType.ts +15 -0
- package/src/types/GenerateDoc.ts +19 -0
- package/src/types/InferDetailedType.test.ts +18 -0
- package/src/types/{InferSpecificType.ts → InferDetailedType.ts} +4 -4
- package/src/types/OfficialTypeAlias.ts +2 -2
- package/src/types/RestorePropertiesDoc.ts +3 -3
- package/tsconfig.json +7 -16
- package/dist/types/InferSpecificType.d.ts +0 -2
- package/dist/types/InferSpecificType.js +0 -2
- package/dist/types/InferSpecificType.js.map +0 -1
- package/dist/types/InferSpecificType.test.js.map +0 -1
- package/dist/types/SpecificType.js +0 -2
- package/dist/types/SpecificType.js.map +0 -1
- package/dist/utils/InternalFieldProtection.d.ts +0 -2
- package/dist/utils/InternalFieldProtection.js +0 -11
- package/dist/utils/InternalFieldProtection.js.map +0 -1
- package/dist/utils/collector.d.ts +0 -5
- package/dist/utils/collector.js +0 -21
- package/dist/utils/collector.js.map +0 -1
- package/dist/utils/computedUpdater.js.map +0 -1
- package/dist/utils/createdHijack.d.ts +0 -0
- package/dist/utils/createdHijack.js +0 -2
- package/dist/utils/createdHijack.js.map +0 -1
- package/dist/utils/customEventsHandle.d.ts +0 -2
- package/dist/utils/customEventsHandle.js +0 -20
- package/dist/utils/customEventsHandle.js.map +0 -1
- package/dist/utils/eventsHandle.d.ts +0 -2
- package/dist/utils/eventsHandle.js +0 -5
- package/dist/utils/eventsHandle.js.map +0 -1
- package/dist/utils/funcConfigHandle.d.ts +0 -2
- package/dist/utils/funcConfigHandle.js +0 -18
- package/dist/utils/funcConfigHandle.js.map +0 -1
- package/dist/utils/getPathsValue.js.map +0 -1
- package/dist/utils/initWatchOldValue.d.ts +0 -2
- package/dist/utils/initWatchOldValue.js +0 -10
- package/dist/utils/initWatchOldValue.js.map +0 -1
- package/dist/utils/onLoadHijack.d.ts +0 -3
- package/dist/utils/onLoadHijack.js +0 -16
- package/dist/utils/onLoadHijack.js.map +0 -1
- package/dist/utils/onLoadReceivedDataHandle.d.ts +0 -3
- package/dist/utils/onLoadReceivedDataHandle.js +0 -14
- package/dist/utils/onLoadReceivedDataHandle.js.map +0 -1
- package/dist/utils/rootComponentFieldHandle.d.ts +0 -3
- package/dist/utils/rootComponentFieldHandle.js +0 -13
- package/dist/utils/rootComponentFieldHandle.js.map +0 -1
- package/dist/utils/subComponentsHandle.d.ts +0 -3
- package/dist/utils/subComponentsHandle.js +0 -12
- package/dist/utils/subComponentsHandle.js.map +0 -1
- package/src/types/InferSpecificType.test.ts +0 -18
- package/src/types/SpecificType.ts +0 -19
- package/src/utils/InternalFieldProtection.ts +0 -18
- package/src/utils/collector.ts +0 -41
- package/src/utils/createdHijack.ts +0 -21
- package/src/utils/customEventsHandle.ts +0 -31
- package/src/utils/eventsHandle.ts +0 -10
- package/src/utils/funcConfigHandle.ts +0 -30
- package/src/utils/initWatchOldValue.ts +0 -12
- package/src/utils/onLoadHijack.ts +0 -30
- package/src/utils/onLoadReceivedDataHandle.ts +0 -31
- package/src/utils/rootComponentFieldHandle.ts +0 -27
- package/src/utils/subComponentsHandle.ts +0 -25
- /package/dist/{utils → behaviors/BComputedAndWatch}/getPathsValue.js +0 -0
- /package/dist/types/{InferSpecificType.test.d.ts → InferDetailedType.test.d.ts} +0 -0
package/src/utils/collector.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
3
|
-
import type { RootComponentDoc } from "../api/RootComponent/RootComponentDoc";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 把配置为函数的字段方法收集到funcConfig中
|
|
7
|
-
*/
|
|
8
|
-
export function funcFieldsCollect(
|
|
9
|
-
config: Record<string, Func>,
|
|
10
|
-
funcConfig: FuncConfig,
|
|
11
|
-
type: "pageLifetimes" | "lifetimes" | "watch",
|
|
12
|
-
) {
|
|
13
|
-
for (const key in config) {
|
|
14
|
-
const handler = config[key];
|
|
15
|
-
// 收集声明周期函数
|
|
16
|
-
const tempCache: object = funcConfig[type] ||= {};
|
|
17
|
-
const filedList: Func[] = tempCache[key] ||= [];
|
|
18
|
-
|
|
19
|
-
filedList.push(handler);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 其他字段加入到componentOptions对应字段配置中
|
|
24
|
-
export function otherFieldsHandle(
|
|
25
|
-
componentOptions: ComponentOptions,
|
|
26
|
-
rootComponentOptions: Omit<RootComponentDoc, "customEvents" | "events" | "pageLifetimes">,
|
|
27
|
-
) {
|
|
28
|
-
for (const key in rootComponentOptions) {
|
|
29
|
-
const config = rootComponentOptions[key];
|
|
30
|
-
// 好像只有behaviors是数组吧?.
|
|
31
|
-
|
|
32
|
-
if (Array.isArray(config)) {
|
|
33
|
-
/* istanbul ignore next */
|
|
34
|
-
componentOptions[key] ||= [];
|
|
35
|
-
|
|
36
|
-
componentOptions[key].push(...config);
|
|
37
|
-
} else {
|
|
38
|
-
Object.assign(componentOptions[key] ||= {}, config);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// export function createdHijack(
|
|
2
|
-
// componentOptions: ComponentOptions,
|
|
3
|
-
// before: Func[] = [],
|
|
4
|
-
// after: Func[] = [],
|
|
5
|
-
// ) {
|
|
6
|
-
// const lifetimes = componentOptions.lifetimes ||= {};
|
|
7
|
-
// // const originalOptions = deepClone(options);
|
|
8
|
-
// const originalCreatedFn = lifetimes.created;
|
|
9
|
-
|
|
10
|
-
// lifetimes.created = function() {
|
|
11
|
-
// before.forEach((func) => {
|
|
12
|
-
// func.call(this, componentOptions);
|
|
13
|
-
// });
|
|
14
|
-
|
|
15
|
-
// originalCreatedFn && originalCreatedFn.call(this);
|
|
16
|
-
|
|
17
|
-
// after.forEach((func) => {
|
|
18
|
-
// func.call(this, componentOptions);
|
|
19
|
-
// });
|
|
20
|
-
// };
|
|
21
|
-
// }
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions } from "../api/DefineComponent";
|
|
2
|
-
import type { FullCustomEvents, ShortCustomeEvents } from "../api/RootComponent/CustomEvents/CustomEventConstraint";
|
|
3
|
-
import type { Instance } from "../behaviors/BComputedAndWatch/types";
|
|
4
|
-
// 类型守卫
|
|
5
|
-
function IsFullCustomEvents(
|
|
6
|
-
customEventOptions: FullCustomEvents | ShortCustomeEvents,
|
|
7
|
-
): customEventOptions is FullCustomEvents {
|
|
8
|
-
return Object.prototype.toString.call(customEventOptions) === "[object Object]";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 把customEvents字段配置变成函数放入到componentOptions.methods中
|
|
13
|
-
*/
|
|
14
|
-
export function customEventsHandle(componentOptions: ComponentOptions, customEventsConfig: object) {
|
|
15
|
-
/* istanbul ignore next */
|
|
16
|
-
componentOptions.methods ||= {};
|
|
17
|
-
|
|
18
|
-
for (const key in customEventsConfig) {
|
|
19
|
-
const customEventOptions = customEventsConfig[key];
|
|
20
|
-
|
|
21
|
-
if (IsFullCustomEvents(customEventOptions)) {
|
|
22
|
-
componentOptions.methods[key] = function(detail: unknown) {
|
|
23
|
-
(this as unknown as Instance).triggerEvent(key, detail, customEventOptions.options);
|
|
24
|
-
};
|
|
25
|
-
} else {
|
|
26
|
-
componentOptions.methods[key] = function(detail: unknown) {
|
|
27
|
-
(this as unknown as Instance).triggerEvent(key, detail);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions } from "../api/DefineComponent";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 把customEvents字段配置变成函数放入到componentOptions.methods中
|
|
5
|
-
*/
|
|
6
|
-
export function eventsHandle(componentOptions: ComponentOptions, eventsConfig: object) {
|
|
7
|
-
componentOptions.methods ||= {};
|
|
8
|
-
|
|
9
|
-
Object.assign(componentOptions.methods, eventsConfig);
|
|
10
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Func } from "hry-types/src/Misc/_api";
|
|
2
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
3
|
-
/**
|
|
4
|
-
* 把函数配置放入一个配置中依次运行
|
|
5
|
-
*/
|
|
6
|
-
function _funcConfigHandle(methodsConfig: object, configList: Record<string, Func[]>) {
|
|
7
|
-
for (const key in configList) {
|
|
8
|
-
methodsConfig[key] = function(...args: unknown[]) {
|
|
9
|
-
configList[key].forEach(ele => ele.call(this, ...args));
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function funcConfigHandle(
|
|
15
|
-
componentOptions: ComponentOptions,
|
|
16
|
-
isPage: boolean | undefined,
|
|
17
|
-
funcConfig: FuncConfig,
|
|
18
|
-
) {
|
|
19
|
-
if (isPage) {
|
|
20
|
-
// 页面时 生命周期方法(即 on 开头的方法),(https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/component.html)
|
|
21
|
-
// 测试框架无法测试page特性
|
|
22
|
-
funcConfig.pageLifetimes && _funcConfigHandle(componentOptions.methods ||= {}, funcConfig.pageLifetimes);
|
|
23
|
-
} else {
|
|
24
|
-
// 组件时
|
|
25
|
-
funcConfig.pageLifetimes && _funcConfigHandle(componentOptions.pageLifetimes ||= {}, funcConfig.pageLifetimes);
|
|
26
|
-
}
|
|
27
|
-
funcConfig.lifetimes && _funcConfigHandle(componentOptions.lifetimes ||= {}, funcConfig.lifetimes);
|
|
28
|
-
|
|
29
|
-
funcConfig.watch && _funcConfigHandle(componentOptions.watch ||= {}, funcConfig.watch);
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Instance, WatchOldValue } from "../behaviors/BComputedAndWatch/types";
|
|
2
|
-
import { deepClone } from "./deepClone";
|
|
3
|
-
import { getPathsValue } from "./getPathsValue";
|
|
4
|
-
|
|
5
|
-
export function initWatchOldValue(this: Instance, watchConfig: object): WatchOldValue {
|
|
6
|
-
const watchOldValue = {};
|
|
7
|
-
for (const key in watchConfig) {
|
|
8
|
-
watchOldValue[key] = deepClone(getPathsValue.call(this, key.split(".")));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return watchOldValue;
|
|
12
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
|
-
import type { ComponentOptions } from "../api/DefineComponent";
|
|
3
|
-
import { deepClone } from "./deepClone";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* onLoad生命周期劫持函数
|
|
7
|
-
*/
|
|
8
|
-
/* istanbul ignore next */
|
|
9
|
-
export function onLoadHijack(
|
|
10
|
-
options: ComponentOptions,
|
|
11
|
-
before: Func[],
|
|
12
|
-
after: Func[] = [],
|
|
13
|
-
) {
|
|
14
|
-
options.methods ||= {};
|
|
15
|
-
|
|
16
|
-
const cloneOpt = deepClone(options);
|
|
17
|
-
const originalOnLoad: Func | undefined = options.methods.onLoad;
|
|
18
|
-
|
|
19
|
-
options.methods.onLoad = function(props: unknown) {
|
|
20
|
-
before.forEach((func) => {
|
|
21
|
-
func.call(this, props, cloneOpt);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
originalOnLoad?.call(this, props);
|
|
25
|
-
|
|
26
|
-
after.forEach((func) => {
|
|
27
|
-
func.call(this, props, cloneOpt);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { PageInstance } from "../api/RootComponent/Instance/RootComponentInstance";
|
|
2
|
-
import { INNERMARKER } from "./InnerMarker";
|
|
3
|
-
/**
|
|
4
|
-
* 对页面onLoad的参数data处理
|
|
5
|
-
* 1. 多余字段检测
|
|
6
|
-
* 2. 少传字段报错
|
|
7
|
-
* 3. 类型错误报错
|
|
8
|
-
* 针对通过 navigateTo传过来的数据解析
|
|
9
|
-
* @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
|
|
10
|
-
*/
|
|
11
|
-
export function onLoadReceivedDataHandle(
|
|
12
|
-
this: PageInstance,
|
|
13
|
-
option: Record<typeof INNERMARKER.url, string>,
|
|
14
|
-
) {
|
|
15
|
-
const innerData: string | undefined = option[INNERMARKER.url];
|
|
16
|
-
// 未使用自定义的navigateTo
|
|
17
|
-
if (innerData === undefined) return;
|
|
18
|
-
const optionData = JSON.parse(decodeURIComponent(innerData));
|
|
19
|
-
|
|
20
|
-
// 使用navigateTo
|
|
21
|
-
for (const key in optionData) {
|
|
22
|
-
option[key] = optionData[key];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// setData会触发计算属性 继承属性等 。
|
|
26
|
-
this.setData(option as any);
|
|
27
|
-
|
|
28
|
-
delete option[INNERMARKER.url];
|
|
29
|
-
|
|
30
|
-
delete this.data[INNERMARKER.url];
|
|
31
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
2
|
-
import type { RootComponentDoc } from "../api/RootComponent/RootComponentDoc";
|
|
3
|
-
import { funcFieldsCollect, otherFieldsHandle } from "./collector";
|
|
4
|
-
|
|
5
|
-
import { customEventsHandle } from "./customEventsHandle";
|
|
6
|
-
import { eventsHandle } from "./eventsHandle";
|
|
7
|
-
|
|
8
|
-
export function rootComponentFieldHandle(
|
|
9
|
-
rootComponentConfig: RootComponentDoc,
|
|
10
|
-
componentOptions: ComponentOptions,
|
|
11
|
-
funcConfig: FuncConfig,
|
|
12
|
-
) {
|
|
13
|
-
rootComponentConfig.customEvents && customEventsHandle(componentOptions, rootComponentConfig.customEvents);
|
|
14
|
-
|
|
15
|
-
rootComponentConfig.events && eventsHandle(componentOptions, rootComponentConfig.events);
|
|
16
|
-
|
|
17
|
-
// 框架不支持测试页面
|
|
18
|
-
/* istanbul ignore next */
|
|
19
|
-
rootComponentConfig.pageLifetimes
|
|
20
|
-
&& funcFieldsCollect(rootComponentConfig.pageLifetimes, funcConfig, "pageLifetimes");
|
|
21
|
-
|
|
22
|
-
rootComponentConfig.lifetimes && funcFieldsCollect(rootComponentConfig.lifetimes, funcConfig, "lifetimes");
|
|
23
|
-
|
|
24
|
-
rootComponentConfig.watch && funcFieldsCollect(rootComponentConfig.watch, funcConfig, "watch");
|
|
25
|
-
|
|
26
|
-
otherFieldsHandle(componentOptions, rootComponentConfig);
|
|
27
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
2
|
-
import type { SubComponentOptions } from "../api/SubComponent";
|
|
3
|
-
import { funcFieldsCollect, otherFieldsHandle } from "./collector";
|
|
4
|
-
|
|
5
|
-
import { eventsHandle } from "./eventsHandle";
|
|
6
|
-
|
|
7
|
-
export function subComponentsHandle(
|
|
8
|
-
componentOptions: ComponentOptions,
|
|
9
|
-
subComponents: SubComponentOptions[],
|
|
10
|
-
funcConfig: FuncConfig,
|
|
11
|
-
) {
|
|
12
|
-
subComponents.forEach((subOption) => {
|
|
13
|
-
subOption.events && eventsHandle(componentOptions, subOption.events);
|
|
14
|
-
|
|
15
|
-
// 框架不支持测试页面
|
|
16
|
-
/* istanbul ignore next */
|
|
17
|
-
subOption.pageLifetimes && funcFieldsCollect(subOption.pageLifetimes, funcConfig, "pageLifetimes");
|
|
18
|
-
|
|
19
|
-
subOption.lifetimes && funcFieldsCollect(subOption.lifetimes, funcConfig, "lifetimes");
|
|
20
|
-
|
|
21
|
-
subOption.watch && funcFieldsCollect(subOption.watch, funcConfig, "watch");
|
|
22
|
-
|
|
23
|
-
otherFieldsHandle(componentOptions, subOption);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|