annil 1.3.0 → 1.5.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/CHANGELOG.md +31 -0
- package/README.md +28 -16
- package/dist/api/DefineComponent/collectOptionsForComponent.js +30 -11
- package/dist/api/DefineComponent/collectOptionsForComponent.js.map +1 -1
- package/dist/api/DefineComponent/index.js.map +1 -1
- package/dist/api/InstanceInject/instanceConfig.d.ts +23 -0
- package/dist/api/InstanceInject/instanceConfig.js +13 -0
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -0
- package/dist/api/InstanceInject/test/normal.test.d.ts +1 -0
- package/dist/api/InstanceInject/test/normal.test.js +30 -0
- package/dist/api/InstanceInject/test/normal.test.js.map +1 -0
- package/dist/api/RootComponent/Computed/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.js +0 -1
- package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/test/GetFullEventDoc.test.js +0 -1
- package/dist/api/RootComponent/CustomEvents/test/GetFullEventDoc.test.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.js +0 -1
- package/dist/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.js.map +1 -1
- package/dist/api/RootComponent/Data/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +4 -4
- package/dist/api/RootComponent/Instance/test/properties/mormal.test.js.map +1 -1
- package/dist/api/RootComponent/Instance/test/setData/error.test.js +0 -8
- package/dist/api/RootComponent/Instance/test/setData/error.test.js.map +1 -1
- package/dist/api/RootComponent/Instance/test/setData/normal.test.js +0 -1
- package/dist/api/RootComponent/Instance/test/setData/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Lifetimes/test/error.test.js +1 -1
- package/dist/api/RootComponent/Lifetimes/test/error.test.js.map +1 -1
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js +1 -1
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalEmpty.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalOptional.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalRequired.test.js.map +1 -1
- package/dist/api/SubComponent/SubComputed/test/normal.test.js.map +1 -1
- package/dist/api/SubComponent/SubData/test/normal.test.js.map +1 -1
- package/dist/api/SubComponent/SubInstance/test/normal.test.js.map +1 -1
- package/dist/api/navigateTo.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/data-tracer.js +3 -0
- package/dist/behaviors/BComputedAndWatch/data-tracer.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/getPropertiesValue.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/index.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/initComputed.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/isEqual.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/types.d.ts +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/inject.d.ts +18 -0
- package/dist/inject.js +20 -0
- package/dist/inject.js.map +1 -0
- package/dist/thirdLib/index.js +1 -2
- package/dist/thirdLib/index.js.map +1 -1
- package/dist/types/Assign.d.ts +1 -0
- package/dist/types/Assign.js +2 -0
- package/dist/types/Assign.js.map +1 -0
- package/dist/types/OfficialTypeAlias.d.ts +1 -1
- package/package.json +5 -4
- package/src/api/DefineComponent/collectOptionsForComponent.ts +55 -11
- package/src/api/DefineComponent/index.ts +1 -0
- package/src/api/InstanceInject/instanceConfig.ts +39 -0
- package/src/api/InstanceInject/test/normal.test.ts +40 -0
- package/src/api/RootComponent/Computed/test/normal.test.ts +14 -11
- package/src/api/RootComponent/Data/test/normal.test.ts +4 -3
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -5
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +6 -1
- package/src/api/RootComponent/Instance/test/setData/error.test.ts +0 -10
- package/src/api/RootComponent/Instance/test/setData/normal.test.ts +0 -3
- package/src/api/RootComponent/Lifetimes/test/error.test.ts +1 -1
- package/src/api/RootComponent/Lifetimes/test/normal.test.ts +1 -1
- package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +4 -2
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +11 -8
- package/src/api/RootComponent/Properties/test/normalRequired.test.ts +2 -1
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +27 -22
- package/src/api/SubComponent/SubData/test/normal.test.ts +9 -6
- package/src/api/SubComponent/SubInstance/test/normal.test.ts +14 -11
- package/src/api/navigateTo.ts +1 -0
- package/src/behaviors/BComputedAndWatch/data-tracer.ts +5 -1
- package/src/behaviors/BComputedAndWatch/getPropertiesValue.ts +3 -0
- package/src/behaviors/BComputedAndWatch/index.ts +1 -0
- package/src/behaviors/BComputedAndWatch/initComputed.ts +1 -0
- package/src/behaviors/BComputedAndWatch/isEqual.ts +1 -0
- package/src/behaviors/BComputedAndWatch/types.ts +0 -1
- package/src/index.ts +3 -0
- package/src/inject.ts +34 -0
- package/src/types/Assign.ts +1 -0
- package/src/types/OfficialTypeAlias.ts +1 -1
- package/tsconfig.json +26 -0
- package/dist/api/InstanceInject/InstanceInject.d.ts +0 -0
- package/dist/api/InstanceInject/InstanceInject.js +0 -2
- package/dist/api/InstanceInject/InstanceInject.js.map +0 -1
- package/dist/api/InstanceInject/test/InjectConfig.d.ts +0 -0
- package/dist/api/InstanceInject/test/InjectConfig.js +0 -2
- package/dist/api/InstanceInject/test/InjectConfig.js.map +0 -1
- package/src/api/InstanceInject/InstanceInject.ts +0 -25
- package/src/api/InstanceInject/test/InjectConfig.ts +0 -50
|
@@ -2,6 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import type { ReadonlyDeep } from "hry-types/src/Any/_api";
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
|
|
4
4
|
|
|
5
|
+
import { IInjectData } from "../../../InstanceInject/instanceConfig";
|
|
5
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
7
|
import { SubComponent } from "../..";
|
|
7
8
|
|
|
@@ -80,17 +81,19 @@ SubComponent<Root, OnlyPropsCompDoc>()({
|
|
|
80
81
|
// 5 this.data
|
|
81
82
|
Checking<
|
|
82
83
|
typeof this.data,
|
|
83
|
-
ReadonlyDeep<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
ReadonlyDeep<
|
|
85
|
+
{
|
|
86
|
+
num: number;
|
|
87
|
+
user: User | null;
|
|
88
|
+
SNum: number;
|
|
89
|
+
str: string;
|
|
90
|
+
bool: boolean;
|
|
91
|
+
aaa_num: number;
|
|
92
|
+
aaa_num123: 123;
|
|
93
|
+
aaa_str: "a";
|
|
94
|
+
aaa_obj: Mock_User;
|
|
95
|
+
} & IInjectData
|
|
96
|
+
>,
|
|
94
97
|
Test.Pass
|
|
95
98
|
>;
|
|
96
99
|
|
|
@@ -102,17 +105,19 @@ SubComponent<Root, OnlyPropsCompDoc>()({
|
|
|
102
105
|
// 5 this.data 深度只读
|
|
103
106
|
Checking<
|
|
104
107
|
typeof this.data,
|
|
105
|
-
ReadonlyDeep<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
ReadonlyDeep<
|
|
109
|
+
{
|
|
110
|
+
num: number;
|
|
111
|
+
user: User | null;
|
|
112
|
+
str: string;
|
|
113
|
+
SNum: number;
|
|
114
|
+
bool: boolean;
|
|
115
|
+
aaa_num: number;
|
|
116
|
+
aaa_num123: 123;
|
|
117
|
+
aaa_str: "a";
|
|
118
|
+
aaa_obj: Mock_User;
|
|
119
|
+
} & IInjectData
|
|
120
|
+
>,
|
|
116
121
|
Test.Pass
|
|
117
122
|
>;
|
|
118
123
|
},
|
|
@@ -2,6 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import type { ReadonlyDeep } from "hry-types/src/Any/_api";
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
|
|
4
4
|
|
|
5
|
+
import { IInjectData } from "../../../InstanceInject/instanceConfig";
|
|
5
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
7
|
import { SubComponent } from "../..";
|
|
7
8
|
|
|
@@ -51,12 +52,14 @@ SubComponent<{}, CompDoc>()({
|
|
|
51
52
|
// 4 this.data中的data配置数据
|
|
52
53
|
Checking<
|
|
53
54
|
typeof this.data,
|
|
54
|
-
ReadonlyDeep<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
ReadonlyDeep<
|
|
56
|
+
{
|
|
57
|
+
aaa_str: "a";
|
|
58
|
+
aaa_num: 123;
|
|
59
|
+
aaa_obj: null;
|
|
60
|
+
_aaa_str: string;
|
|
61
|
+
} & IInjectData
|
|
62
|
+
>,
|
|
60
63
|
Test.Pass
|
|
61
64
|
>;
|
|
62
65
|
},
|
|
@@ -2,6 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import type { ReadonlyDeep } from "hry-types/src/Any/_api";
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
|
|
4
4
|
|
|
5
|
+
import { IInjectData } from "../../../InstanceInject/instanceConfig";
|
|
5
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
7
|
import type { RootComponentDoc } from "../../../RootComponent/RootComponentDoc";
|
|
7
8
|
import { SubComponent } from "../..";
|
|
@@ -57,17 +58,19 @@ SubComponent<RootDoc, CompDoc>()({
|
|
|
57
58
|
// this.data
|
|
58
59
|
Checking<
|
|
59
60
|
typeof this.data,
|
|
60
|
-
ReadonlyDeep<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
ReadonlyDeep<
|
|
62
|
+
{
|
|
63
|
+
// RootData
|
|
64
|
+
Pstr: string;
|
|
65
|
+
Pobj: Mock_User | null;
|
|
66
|
+
PoptionalObj: Mock_User;
|
|
67
|
+
Dnum: number;
|
|
68
|
+
Cnum: number;
|
|
69
|
+
// 自身Data
|
|
70
|
+
aaa_str: "str";
|
|
71
|
+
_aaa_SubReactive: 123;
|
|
72
|
+
} & IInjectData
|
|
73
|
+
>,
|
|
71
74
|
Test.Pass
|
|
72
75
|
>;
|
|
73
76
|
|
package/src/api/navigateTo.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function deepProxy(
|
|
|
11
11
|
// console.log(target, prop);
|
|
12
12
|
|
|
13
13
|
if (prop === "__rawObject__") return target;
|
|
14
|
-
|
|
14
|
+
// @ts-ignore 隐式索引
|
|
15
15
|
const val = target[prop];
|
|
16
16
|
|
|
17
17
|
// console.log("获取依赖", prop, val);
|
|
@@ -42,6 +42,10 @@ export function deepProxy(
|
|
|
42
42
|
|
|
43
43
|
return deepProxy(val, dependences, curPath);
|
|
44
44
|
},
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
set(_target: object, prop: string) {
|
|
47
|
+
throw Error(`${prop}字段是只读的`);
|
|
48
|
+
},
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
return new Proxy(data, handler);
|
|
@@ -42,10 +42,13 @@ export function getPropertiesValue(propertiesOpt: PropertiesConstraint | undefin
|
|
|
42
42
|
const config = propertiesOpt[key];
|
|
43
43
|
/* istanbul ignore next */
|
|
44
44
|
if (IsRequiredSingle(config)) {
|
|
45
|
+
// @ts-ignore 隐式索引
|
|
45
46
|
result[key] = getRequiredSingleValue(config);
|
|
46
47
|
} else if (IsRequiredUnion(config)) {
|
|
48
|
+
// @ts-ignore 隐式索引
|
|
47
49
|
result[key] = getRequiredSingleValue(config.type);
|
|
48
50
|
} else {
|
|
51
|
+
// @ts-ignore 隐式索引
|
|
49
52
|
result[key] = config.value;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -12,6 +12,7 @@ import type { Instance, WatchOldValue } from "./types";
|
|
|
12
12
|
function initWatchOldValue(this: Instance, watchConfig: object): WatchOldValue {
|
|
13
13
|
const watchOldValue = {};
|
|
14
14
|
for (const key in watchConfig) {
|
|
15
|
+
// @ts-ignore 隐式索引
|
|
15
16
|
watchOldValue[key] = deepClone(getPathsValue(this.data, key));
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -3,7 +3,6 @@ import type { ComponentInstance, PageInstance } from "../../api/RootComponent/In
|
|
|
3
3
|
import type { ComputedDependence } from "./initComputed";
|
|
4
4
|
|
|
5
5
|
export type InstanceCustomFields = {
|
|
6
|
-
__pendingSetData__?: object | null;
|
|
7
6
|
__storeConfig__?: () => Record<string, () => unknown>;
|
|
8
7
|
__computedStatus__?: "待更新" | "更新完毕";
|
|
9
8
|
__computedUpdater__: Func;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefineComponent } from "./api/DefineComponent";
|
|
2
|
+
import { type IInjectInfo, instanceConfig } from "./api/InstanceInject/instanceConfig";
|
|
2
3
|
import { navigateTo } from "./api/navigateTo";
|
|
3
4
|
import { RootComponent } from "./api/RootComponent";
|
|
4
5
|
import { SubComponent } from "./api/SubComponent";
|
|
@@ -23,6 +24,8 @@ export {
|
|
|
23
24
|
DefineComponent,
|
|
24
25
|
type DetailedType,
|
|
25
26
|
type GenerateDoc,
|
|
27
|
+
type IInjectInfo,
|
|
28
|
+
instanceConfig,
|
|
26
29
|
/* istanbul ignore next */
|
|
27
30
|
navigateTo,
|
|
28
31
|
type ParamsEqual,
|
package/src/inject.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { observable, runInAction } from "mobx";
|
|
2
|
+
|
|
3
|
+
// 注入的响应式数据;
|
|
4
|
+
const themeStore = observable({ theme: wx.getSystemInfoSync().theme });
|
|
5
|
+
|
|
6
|
+
wx.onThemeChange((Res) => {
|
|
7
|
+
runInAction(() => {
|
|
8
|
+
themeStore.theme = Res.theme;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// 注入的方法;
|
|
13
|
+
function injectMethod(data: string) {
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const data = {
|
|
18
|
+
injectStr: "injectStr",
|
|
19
|
+
};
|
|
20
|
+
const methods = {
|
|
21
|
+
injectMethod,
|
|
22
|
+
};
|
|
23
|
+
const store = {
|
|
24
|
+
injectTheme: () => themeStore.theme,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// 声明注入类型 js开发可以忽略
|
|
28
|
+
declare module "./index" {
|
|
29
|
+
interface IInjectInfo {
|
|
30
|
+
data: typeof data;
|
|
31
|
+
store: typeof store;
|
|
32
|
+
methods: typeof methods;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Assign<O1, O2> = Omit<O1, keyof O2> & O2;
|
|
@@ -55,7 +55,7 @@ export type CurrentTargetDataset<T extends object> = WMCustomEvent<{}, {}, T>;
|
|
|
55
55
|
*/
|
|
56
56
|
export type TargetDataset<TargetDataset extends object> = WMCustomEvent<{}, {}, {}, TargetDataset>;
|
|
57
57
|
|
|
58
|
-
export type WMComponentOption = WechatMiniprogram.Component.
|
|
58
|
+
export type WMComponentOption = WechatMiniprogram.Component.ComponentOptions;
|
|
59
59
|
|
|
60
60
|
export type WMNavigateToSuccessCallbackResult = WechatMiniprogram.NavigateToSuccessCallbackResult;
|
|
61
61
|
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["ES2022", "DOM"], // jest中用到了DOM类型
|
|
4
|
+
"target": "ES2017",
|
|
5
|
+
"module": "ES2022",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"strictFunctionTypes": false, // e: Dataset<{ id: string }>会报错。
|
|
8
|
+
"exactOptionalPropertyTypes": true, // 带有?标志的属性类型不在包含undefined
|
|
9
|
+
"skipLibCheck": true, // 跳过声明文件的类型检查(.d.ts),除了你引用的, 默认false(不跳过)。
|
|
10
|
+
"moduleResolution": "Bundler", // 模块解析策略 //5.0 新值 bundler
|
|
11
|
+
"noImplicitAny": true, // 不允许隐式的any类型
|
|
12
|
+
"esModuleInterop": true, // 默认false 将 CommonJS/AMD/UMD 模块视为类似于 ES6 模块,jest需要。
|
|
13
|
+
"removeComments": true, // 去除注释
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"noImplicitReturns": true, // 隐式函数返回
|
|
16
|
+
"forceConsistentCasingInFileNames": true, // 区分文件名的大小写
|
|
17
|
+
// "noUnusedLocals": true, // 报告未使用局部变量的错误
|
|
18
|
+
// "noUnusedParameters": false, // 报告函数中未使用参数的错误
|
|
19
|
+
// "suppressImplicitAnyIndexErrors": true, // 为true关闭隐式索引错误,但很激进,建议使用@ts-ignore
|
|
20
|
+
"isolatedModules": true, // 模块化(.ts文件必须有导入或导出) 默认false
|
|
21
|
+
// "verbatimModuleSyntax": true,不能开启.jset会报错,在vscode中设置代替它要求ts版本>5.3
|
|
22
|
+
// 默认加载所有@types下的包 types指定具体的包,其他拒绝。包含上级目录
|
|
23
|
+
"types": ["hry-types", "mobx", "jest", "miniprogram-api-typings"]
|
|
24
|
+
},
|
|
25
|
+
"include": ["**/*.ts"]
|
|
26
|
+
}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InstanceInject.js","sourceRoot":"","sources":["../../../src/api/InstanceInject/InstanceInject.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InjectConfig.js","sourceRoot":"","sources":["../../../../src/api/InstanceInject/test/InjectConfig.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// import type { WMComponentOption } from "../../types/officialAlias";
|
|
2
|
-
|
|
3
|
-
// // export type InjectMethodConstraint = Record<string, Func>;
|
|
4
|
-
|
|
5
|
-
// // export type InjectDataConstraint = Record<string, unknown>;
|
|
6
|
-
|
|
7
|
-
// export abstract class Inject {
|
|
8
|
-
// public options?: WMComponentOption;
|
|
9
|
-
// // public methods?: InjectMethodConstraint;
|
|
10
|
-
// // public data?: InjectDataConstraint;
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
// /**
|
|
14
|
-
// * 实例注入接口,加入数据到所有实例中(当前仅支持data,methods,options字段),可在this上获取对应数据 响应式需函数返回方式
|
|
15
|
-
// * @example
|
|
16
|
-
// */
|
|
17
|
-
// export class InstanceInject extends Inject {
|
|
18
|
-
// private static _injectOption = new InstanceInject();
|
|
19
|
-
// public static get InjectOption(): InstanceInject {
|
|
20
|
-
// return this._injectOption;
|
|
21
|
-
// }
|
|
22
|
-
// public static set InjectOption(options: InstanceInject) {
|
|
23
|
-
// this._injectOption = options;
|
|
24
|
-
// }
|
|
25
|
-
// }
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { InstanceInject } from "../../..";
|
|
2
|
-
|
|
3
|
-
// import { observable } from "mobx";
|
|
4
|
-
// import type { InjectDataConstraint, InjectMethodConstraint } from "../InstanceInject";
|
|
5
|
-
|
|
6
|
-
// const reactiveUser = observable({
|
|
7
|
-
// name: "zhao",
|
|
8
|
-
// age: 18,
|
|
9
|
-
// });
|
|
10
|
-
|
|
11
|
-
// /**
|
|
12
|
-
// * @description 注入的data
|
|
13
|
-
// */
|
|
14
|
-
// const data = {
|
|
15
|
-
// // 响应式数据
|
|
16
|
-
// reactiveUser: () => reactiveUser,
|
|
17
|
-
// // 非响应式数据
|
|
18
|
-
// injectStr: "injectStr",
|
|
19
|
-
// } satisfies InjectDataConstraint;
|
|
20
|
-
// /**
|
|
21
|
-
// * @description 注入的方法
|
|
22
|
-
// */
|
|
23
|
-
// const methods = {
|
|
24
|
-
// injectMethod(data: string) {
|
|
25
|
-
// console.log(data);
|
|
26
|
-
// },
|
|
27
|
-
// } satisfies InjectMethodConstraint;
|
|
28
|
-
/**
|
|
29
|
-
* 注入的配置
|
|
30
|
-
*/
|
|
31
|
-
// const options = {
|
|
32
|
-
// addGlobalClass: true,
|
|
33
|
-
// multipleSlots: true,
|
|
34
|
-
// pureDataPattern: /^_/,
|
|
35
|
-
// virtualHost: true,
|
|
36
|
-
// };
|
|
37
|
-
|
|
38
|
-
// InstanceInject.InjectOption = {
|
|
39
|
-
// // data,
|
|
40
|
-
// options,
|
|
41
|
-
// // methods,
|
|
42
|
-
// };
|
|
43
|
-
|
|
44
|
-
// 声明注入类型
|
|
45
|
-
// declare module "../../.." {
|
|
46
|
-
// interface InstanceInject {
|
|
47
|
-
// data: typeof data;
|
|
48
|
-
// methods: typeof methods;
|
|
49
|
-
// }
|
|
50
|
-
// }
|