annil 1.7.1 → 1.7.3
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 +14 -0
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js +4 -4
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js.map +1 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.d.ts +1 -3
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js +11 -8
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js.map +1 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.d.ts +3 -0
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.js +23 -0
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.js.map +1 -0
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js +2 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js.map +1 -1
- package/dist/thirdLib/wm/scrollView.d.ts +0 -2
- package/dist/thirdLib/wm/swiper.d.ts +1 -1
- package/dist/thirdLib/wm/view.d.ts +4 -6
- package/package.json +1 -1
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts +5 -6
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts +16 -12
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.ts +33 -0
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.ts +3 -2
- package/src/api/SubComponent/SubWatch/test/error.test.ts +3 -3
- package/src/thirdLib/wm/scrollView.ts +0 -2
- package/src/thirdLib/wm/swiper.ts +1 -1
- package/src/thirdLib/wm/view.ts +4 -6
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/uniqueDependences.d.ts +0 -2
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/uniqueDependences.js +0 -40
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/uniqueDependences.js.map +0 -1
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/uniqueDependences.ts +0 -98
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.7.3](https://github.com/missannil/annil/compare/v1.7.2...v1.7.3) (2024-05-03)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* 优化计算属性依赖 ([017ad55](https://github.com/missannil/annil/commit/017ad55d0bc3edcc2cdeec68474adba766da57b7))
|
|
13
|
+
|
|
14
|
+
## [1.7.2](https://github.com/missannil/annil/compare/v1.7.1...v1.7.2) (2024-04-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* 1. 计算属性依赖优化和返回值为代理的问题 ([6f28738](https://github.com/missannil/annil/commit/6f28738256c1884334b440271741ee1efb9e5519))
|
|
20
|
+
|
|
7
21
|
## [1.7.1](https://github.com/missannil/annil/compare/v1.7.0...v1.7.1) (2024-04-12)
|
|
8
22
|
|
|
9
23
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { deepProxy, getProxyOriginalValue } from "./data-tracer";
|
|
2
|
+
import { removeSubDependences } from "./dependencesOptimize";
|
|
2
3
|
import { getPathsValue } from "./getPathsValue";
|
|
3
4
|
import { isEqual } from "./isEqual";
|
|
4
5
|
export function computedUpdater(isUpdated = false) {
|
|
@@ -14,13 +15,12 @@ export function computedUpdater(isUpdated = false) {
|
|
|
14
15
|
}
|
|
15
16
|
if (changed) {
|
|
16
17
|
const newDependences = [];
|
|
17
|
-
|
|
18
|
-
newValue = getProxyOriginalValue(newValue);
|
|
18
|
+
const newValue = itemCache.method.call({ data: deepProxy(this.data, newDependences) });
|
|
19
19
|
this.setData({
|
|
20
|
-
[key]: newValue,
|
|
20
|
+
[key]: getProxyOriginalValue(newValue),
|
|
21
21
|
});
|
|
22
22
|
isUpdated = true;
|
|
23
|
-
this.data.__computedCache__[key].dependences = newDependences;
|
|
23
|
+
this.data.__computedCache__[key].dependences = removeSubDependences(newDependences);
|
|
24
24
|
return computedUpdater.call(this, isUpdated);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computedUpdater.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,eAAe,CAAiB,SAAS,GAAG,KAAK;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAExC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAGhE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9B,OAAO,GAAG,IAAI,CAAC;gBAEf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAChD,
|
|
1
|
+
{"version":3,"file":"computedUpdater.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,eAAe,CAAiB,SAAS,GAAG,KAAK;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAExC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAGhE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9B,OAAO,GAAG,IAAI,CAAC;gBAEf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;YAGvF,IAAI,CAAC,OAAO,CAAC;gBACX,CAAC,GAAG,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC;aACvC,CAAC,CAAC;YAEH,SAAS,GAAG,IAAI,CAAC;YAGjB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;YAGpF,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { ComputedDependence } from "./computedUpdater";
|
|
2
2
|
export declare function deepProxy(data: object, dependences: ComputedDependence[], basePath?: string[]): object;
|
|
3
|
-
export declare function getProxyOriginalValue
|
|
4
|
-
__original__?: string;
|
|
5
|
-
}>(value: T): unknown;
|
|
3
|
+
export declare function getProxyOriginalValue(value: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { uniqueDependences } from "./uniqueDependences";
|
|
1
|
+
import { removePreviousDependence } from "./dependencesOptimize";
|
|
3
2
|
export function deepProxy(data, dependences, basePath = []) {
|
|
4
3
|
const handler = {
|
|
5
4
|
get(target, prop) {
|
|
@@ -7,10 +6,10 @@ export function deepProxy(data, dependences, basePath = []) {
|
|
|
7
6
|
return target;
|
|
8
7
|
}
|
|
9
8
|
const val = target[prop];
|
|
10
|
-
if (
|
|
11
|
-
return val.bind(target);
|
|
9
|
+
if (prop in target && !target.hasOwnProperty(prop)) {
|
|
10
|
+
return typeof val === "function" ? val.bind(target) : val;
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
removePreviousDependence(dependences, basePath);
|
|
14
13
|
const curPath = basePath.concat(prop);
|
|
15
14
|
dependences.push({ paths: curPath, val });
|
|
16
15
|
if (typeof val !== "object" || val === null)
|
|
@@ -24,11 +23,15 @@ export function deepProxy(data, dependences, basePath = []) {
|
|
|
24
23
|
return new Proxy(data, handler);
|
|
25
24
|
}
|
|
26
25
|
export function getProxyOriginalValue(value) {
|
|
27
|
-
if (typeof value !== "object" || value === null
|
|
26
|
+
if (typeof value !== "object" || value === null) {
|
|
28
27
|
return value;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
return
|
|
29
|
+
if (value.__original__)
|
|
30
|
+
return value.__original__;
|
|
31
|
+
const ret = Array.isArray(value) ? [] : {};
|
|
32
|
+
for (const key in value) {
|
|
33
|
+
ret[key] = getProxyOriginalValue(value[key]);
|
|
32
34
|
}
|
|
35
|
+
return ret;
|
|
33
36
|
}
|
|
34
37
|
//# sourceMappingURL=data-tracer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-tracer.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-tracer.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,WAAiC,EACjC,WAAqB,EAAE;IAEvB,MAAM,OAAO,GAAG;QACd,GAAG,CAAmB,MAAS,EAAE,IAAsB;YACrD,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAGzB,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAC5D,CAAC;YACD,wBAAwB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAEhD,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEtC,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;YAG1C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,GAAG,CAAC;YAExD,OAAO,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QACD,GAAG,CAAC,OAAe,EAAE,IAAY;YAC/B,MAAM,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC,YAAY,CAAC;IAElD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QAExB,GAAG,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComputedDependence } from "./computedUpdater";
|
|
2
|
+
export declare function removeSubDependences(dependences: ComputedDependence[]): ComputedDependence[];
|
|
3
|
+
export declare function removePreviousDependence(dependences: ComputedDependence[], basePath: string[]): ComputedDependence[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function removeSubDependences(dependences) {
|
|
2
|
+
dependences.sort((a, b) => a.paths.length - b.paths.length);
|
|
3
|
+
for (let f = 0; f < dependences.length; f++) {
|
|
4
|
+
const sortPath = dependences[f].paths.toString();
|
|
5
|
+
for (let i = dependences.length - 1; i > f; i--) {
|
|
6
|
+
const curPath = dependences[i].paths.toString();
|
|
7
|
+
if (curPath.startsWith(sortPath)) {
|
|
8
|
+
dependences.splice(i, 1);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return dependences;
|
|
13
|
+
}
|
|
14
|
+
export function removePreviousDependence(dependences, basePath) {
|
|
15
|
+
if (dependences.length === 0 || basePath.length === 0)
|
|
16
|
+
return dependences;
|
|
17
|
+
const lastDependence = dependences[dependences.length - 1];
|
|
18
|
+
if (lastDependence.paths.toString() === basePath.toString()) {
|
|
19
|
+
dependences.pop();
|
|
20
|
+
}
|
|
21
|
+
return dependences;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dependencesOptimize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencesOptimize.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,WAAiC;IAEpE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAG5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjD,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAGD,MAAM,UAAU,wBAAwB,CAAC,WAAiC,EAAE,QAAkB;IAC5F,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAE1E,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE3D,IAAI,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC5D,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { deepProxy, getProxyOriginalValue } from "./data-tracer";
|
|
2
|
+
import { removeSubDependences } from "./dependencesOptimize";
|
|
2
3
|
function isValidDependences(dependences, computedKeys) {
|
|
3
4
|
for (const { paths: path, val } of dependences) {
|
|
4
5
|
if ((val === undefined) && computedKeys.includes(path[0])) {
|
|
@@ -18,7 +19,7 @@ export function initComputedAndGetCache(options, computedConfig, initAllData, un
|
|
|
18
19
|
options.data[key] = initValue;
|
|
19
20
|
initAllData[key] = initValue;
|
|
20
21
|
computedCache[key] = {
|
|
21
|
-
dependences,
|
|
22
|
+
dependences: removeSubDependences(dependences),
|
|
22
23
|
method: computedFunc,
|
|
23
24
|
value: initValue,
|
|
24
25
|
};
|
package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initComputedAndGetCache.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"initComputedAndGetCache.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAe7D,SAAS,kBAAkB,CAAC,WAAiC,EAAE,YAAsB;IACnF,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,WAAW,EAAE,CAAC;QAC/C,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAGD,OAAO,IAAI,CAAC;AACd,CAAC;AAWD,MAAM,UAAU,uBAAuB,CACrC,OAAgC,EAChC,cAAoC,EACpC,WAAoC,EACpC,eAAyB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EACpD,gBAA+B,EAAE;IAEjC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,WAAW,GAAyB,EAAE,CAAC;QAE7C,IAAI,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;QAGjF,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QAGvD,IAAI,kBAAkB,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;YAClD,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;YAG7C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;YAG9B,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;YAE7B,aAAa,CAAC,GAAG,CAAC,GAAG;gBACnB,WAAW,EAAE,oBAAoB,CAAC,WAAW,CAAC;gBAC9C,MAAM,EAAE,YAAY;gBACpB,KAAK,EAAE,SAAS;aACjB,CAAC;QACJ,CAAC;aAAM,CAAC;YAEN,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC;IACvB,CAAC;IAGD,OAAO,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACpG,CAAC"}
|
|
@@ -2,8 +2,6 @@ import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
|
2
2
|
import type { CreateComponentDoc } from "../../types/CreateComponentDoc";
|
|
3
3
|
export type ScrollView = CreateComponentDoc<"scrollView", {
|
|
4
4
|
properties: {
|
|
5
|
-
class?: string;
|
|
6
|
-
style?: string;
|
|
7
5
|
scroll_x?: boolean;
|
|
8
6
|
scroll_y?: boolean;
|
|
9
7
|
upper_threshold?: number | string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { CreateComponentDoc } from "../../types/CreateComponentDoc";
|
|
2
2
|
export type View = CreateComponentDoc<"view", {
|
|
3
3
|
properties: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hover_start_time?: number;
|
|
9
|
-
hover_stay_time?: number;
|
|
4
|
+
hoverClass?: string;
|
|
5
|
+
hoverStopPropagation?: boolean;
|
|
6
|
+
hoverStartTime?: number;
|
|
7
|
+
hoverStayTime?: number;
|
|
10
8
|
};
|
|
11
9
|
}>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Instance } from "..";
|
|
2
2
|
import { deepProxy, getProxyOriginalValue } from "./data-tracer";
|
|
3
|
+
import { removeSubDependences } from "./dependencesOptimize";
|
|
3
4
|
import { getPathsValue } from "./getPathsValue";
|
|
4
5
|
|
|
5
6
|
import { isEqual } from "./isEqual";
|
|
@@ -22,19 +23,17 @@ export function computedUpdater(this: Instance, isUpdated = false): boolean {
|
|
|
22
23
|
}
|
|
23
24
|
if (changed) {
|
|
24
25
|
const newDependences: ComputedDependence[] = [];
|
|
25
|
-
|
|
26
|
+
const newValue = itemCache.method.call({ data: deepProxy(this.data, newDependences) });
|
|
26
27
|
|
|
27
28
|
// 更新值不会立即再次进入**函数,而是当前**函数运行完毕后触发**函数,
|
|
28
|
-
newValue = getProxyOriginalValue(newValue);
|
|
29
|
-
|
|
30
29
|
this.setData({
|
|
31
|
-
[key]: newValue,
|
|
30
|
+
[key]: getProxyOriginalValue(newValue),
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
isUpdated = true;
|
|
35
34
|
|
|
36
|
-
//
|
|
37
|
-
this.data.__computedCache__[key].dependences = newDependences;
|
|
35
|
+
// 更新依赖(优化)
|
|
36
|
+
this.data.__computedCache__[key].dependences = removeSubDependences(newDependences);
|
|
38
37
|
|
|
39
38
|
// 有一个计算属性更新就重新更新所有计算互相,避免后置依赖导致前置依赖错误
|
|
40
39
|
return computedUpdater.call(this, isUpdated);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable complexity */
|
|
2
|
-
import { deepClone } from "../../../../utils/deepClone";
|
|
3
2
|
import type { ComputedDependence } from "./computedUpdater";
|
|
4
|
-
import {
|
|
3
|
+
import { removePreviousDependence } from "./dependencesOptimize";
|
|
5
4
|
|
|
6
5
|
export function deepProxy(
|
|
7
6
|
data: object,
|
|
@@ -15,13 +14,11 @@ export function deepProxy(
|
|
|
15
14
|
}
|
|
16
15
|
const val = target[prop];
|
|
17
16
|
|
|
18
|
-
//
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
return (val as Function).bind(target);
|
|
17
|
+
// 自身没有但原型链上有的属性不收集依赖
|
|
18
|
+
if (prop in target && !target.hasOwnProperty(prop)) {
|
|
19
|
+
return typeof val === "function" ? val.bind(target) : val;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
dependences = uniqueDependences(dependences, basePath, prop);
|
|
21
|
+
removePreviousDependence(dependences, basePath);
|
|
25
22
|
|
|
26
23
|
const curPath = basePath.concat(prop);
|
|
27
24
|
|
|
@@ -40,10 +37,17 @@ export function deepProxy(
|
|
|
40
37
|
return new Proxy(data, handler);
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
export function getProxyOriginalValue
|
|
44
|
-
if (typeof value !== "object" || value === null
|
|
40
|
+
export function getProxyOriginalValue(value: any): any {
|
|
41
|
+
if (typeof value !== "object" || value === null) {
|
|
45
42
|
return value;
|
|
46
|
-
} else {
|
|
47
|
-
return deepClone(value.__original__);
|
|
48
43
|
}
|
|
44
|
+
if (value.__original__) return value.__original__;
|
|
45
|
+
|
|
46
|
+
const ret = Array.isArray(value) ? [] : {};
|
|
47
|
+
for (const key in value) {
|
|
48
|
+
// @ts-ignore 隐式索引
|
|
49
|
+
ret[key] = getProxyOriginalValue(value[key]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return ret;
|
|
49
53
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComputedDependence } from "./computedUpdater";
|
|
2
|
+
// 去除子依赖
|
|
3
|
+
export function removeSubDependences(dependences: ComputedDependence[]) {
|
|
4
|
+
// 把dependences按照路径长度排序
|
|
5
|
+
dependences.sort((a, b) => a.paths.length - b.paths.length);
|
|
6
|
+
|
|
7
|
+
// 从最长的路径开始遍历,如果当前路径是上一个路径的子路径,则删除当前路径
|
|
8
|
+
for (let f = 0; f < dependences.length; f++) {
|
|
9
|
+
const sortPath = dependences[f].paths.toString();
|
|
10
|
+
// 从后往前遍历,删除子依赖,保留父依赖
|
|
11
|
+
for (let i = dependences.length - 1; i > f; i--) {
|
|
12
|
+
const curPath = dependences[i].paths.toString();
|
|
13
|
+
if (curPath.startsWith(sortPath)) {
|
|
14
|
+
dependences.splice(i, 1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return dependences;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 当前依赖是上一个依赖的子依赖时,去除上一个依赖
|
|
23
|
+
export function removePreviousDependence(dependences: ComputedDependence[], basePath: string[]) {
|
|
24
|
+
if (dependences.length === 0 || basePath.length === 0) return dependences;
|
|
25
|
+
|
|
26
|
+
const lastDependence = dependences[dependences.length - 1];
|
|
27
|
+
|
|
28
|
+
if (lastDependence.paths.toString() === basePath.toString()) {
|
|
29
|
+
dependences.pop();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return dependences;
|
|
33
|
+
}
|
package/src/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { FinalOptionsOfComponent } from "..";
|
|
|
3
3
|
|
|
4
4
|
import type { ComputedDependence } from "./computedUpdater";
|
|
5
5
|
import { deepProxy, getProxyOriginalValue } from "./data-tracer";
|
|
6
|
+
import { removeSubDependences } from "./dependencesOptimize";
|
|
6
7
|
|
|
7
8
|
type ItemCache = {
|
|
8
9
|
dependences: ComputedDependence[];
|
|
@@ -15,7 +16,7 @@ type ComputedId = string;
|
|
|
15
16
|
export type ComputedCache = Record<ComputedId, ItemCache>;
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
* 如果依赖列表某项的首个字段值为undefined并且字段为其他计算属性字段 返回false
|
|
19
|
+
* 如果依赖列表某项的首个字段值为undefined并且字段为其他计算属性字段(即被依赖的计算字段写在了依赖他的计算字段后面) 返回false, 否则返回true表示依赖有效。
|
|
19
20
|
*/
|
|
20
21
|
function isValidDependences(dependences: ComputedDependence[], computedKeys: string[]): boolean {
|
|
21
22
|
for (const { paths: path, val } of dependences) {
|
|
@@ -64,7 +65,7 @@ export function initComputedAndGetCache(
|
|
|
64
65
|
initAllData[key] = initValue;
|
|
65
66
|
|
|
66
67
|
computedCache[key] = {
|
|
67
|
-
dependences,
|
|
68
|
+
dependences: removeSubDependences(dependences),
|
|
68
69
|
method: computedFunc,
|
|
69
70
|
value: initValue,
|
|
70
71
|
};
|
|
@@ -14,16 +14,16 @@ SubComponent<{ events: { a: string } }, Wm.View>()({
|
|
|
14
14
|
*/
|
|
15
15
|
SubComponent<{ events: { a: string } }, Wm.View>()({
|
|
16
16
|
data: {
|
|
17
|
-
|
|
17
|
+
view_hoverClass: " h-100",
|
|
18
18
|
},
|
|
19
19
|
watch: {
|
|
20
|
-
|
|
20
|
+
view_hoverClass(newValue, oldValue) { // ok
|
|
21
21
|
newValue;
|
|
22
22
|
|
|
23
23
|
oldValue;
|
|
24
24
|
},
|
|
25
25
|
// @ts-expect-error 超出约束字段错误
|
|
26
|
-
|
|
26
|
+
view_xxxhoverClass() {
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
});
|
package/src/thirdLib/wm/view.ts
CHANGED
|
@@ -2,27 +2,25 @@ import type { CreateComponentDoc } from "../../types/CreateComponentDoc";
|
|
|
2
2
|
|
|
3
3
|
export type View = CreateComponentDoc<"view", {
|
|
4
4
|
properties: {
|
|
5
|
-
class?: string;
|
|
6
|
-
style?: string;
|
|
7
5
|
/**
|
|
8
6
|
* 指定按下去的样式类。当 hover-class="none" 时,没有点击态效果
|
|
9
7
|
* @defaultValue 'none'
|
|
10
8
|
*/
|
|
11
|
-
|
|
9
|
+
hoverClass?: string;
|
|
12
10
|
/**
|
|
13
11
|
* 指定是否阻止本节点的祖先节点出现点击态
|
|
14
12
|
* @defaultValue false
|
|
15
13
|
*/
|
|
16
|
-
|
|
14
|
+
hoverStopPropagation?: boolean;
|
|
17
15
|
/**
|
|
18
16
|
* 按住后多久出现点击态,单位毫秒
|
|
19
17
|
* @defaultValue 50
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
hoverStartTime?: number;
|
|
22
20
|
/**
|
|
23
21
|
* 手指松开后点击态保留时间,单位毫秒
|
|
24
22
|
* @defaultValue 400
|
|
25
23
|
*/
|
|
26
|
-
|
|
24
|
+
hoverStayTime?: number;
|
|
27
25
|
};
|
|
28
26
|
}>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function sameDependences(dependences) {
|
|
2
|
-
for (let f = 0; f < dependences.length; f++) {
|
|
3
|
-
const firstPath = dependences[f].paths.toString();
|
|
4
|
-
for (let i = f + 1; i < dependences.length; i++) {
|
|
5
|
-
const curPath = dependences[i].paths.toString();
|
|
6
|
-
if (firstPath === curPath) {
|
|
7
|
-
dependences.splice(f, 1);
|
|
8
|
-
return sameDependences(dependences);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return dependences;
|
|
13
|
-
}
|
|
14
|
-
function serialDependences(dependences, basePath) {
|
|
15
|
-
const lastDependence = dependences[dependences.length - 1];
|
|
16
|
-
if (lastDependence.paths.toString() === basePath.toString()) {
|
|
17
|
-
dependences.pop();
|
|
18
|
-
}
|
|
19
|
-
return dependences;
|
|
20
|
-
}
|
|
21
|
-
function separatedDependences(dependences, basePath, prop) {
|
|
22
|
-
const lastDependence = dependences[dependences.length - 1].val;
|
|
23
|
-
if (typeof lastDependence === "string"
|
|
24
|
-
&& dependences[dependences.length - 2].paths.concat(lastDependence).toString()
|
|
25
|
-
=== basePath.concat(prop).toString()) {
|
|
26
|
-
dependences.splice(dependences.length - 2, 1);
|
|
27
|
-
}
|
|
28
|
-
return dependences;
|
|
29
|
-
}
|
|
30
|
-
export function uniqueDependences(dependences, basePath, prop) {
|
|
31
|
-
if (dependences.length === 0)
|
|
32
|
-
return dependences;
|
|
33
|
-
dependences = sameDependences(dependences);
|
|
34
|
-
dependences = serialDependences(dependences, basePath);
|
|
35
|
-
if (dependences.length >= 2) {
|
|
36
|
-
dependences = separatedDependences(dependences, basePath, prop);
|
|
37
|
-
}
|
|
38
|
-
return dependences;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=uniqueDependences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniqueDependences.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/uniqueDependences.ts"],"names":[],"mappings":"AAEA,SAAS,eAAe,CAAC,WAAiC;IACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;gBAC1B,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEzB,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,iBAAiB,CAAC,WAAiC,EAAE,QAAkB;IAC9E,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3D,IAAI,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC5D,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAiC,EAAE,QAAkB,EAAE,IAAY;IAC/F,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/D,IACE,OAAO,cAAc,KAAK,QAAQ;WAC/B,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;gBACxE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EACtC,CAAC;QACD,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAKD,MAAM,UAAU,iBAAiB,CAC/B,WAAiC,EACjC,QAAkB,EAClB,IAAY;IAEZ,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAEjD,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAG3C,WAAW,GAAG,iBAAiB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAGvD,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5B,WAAW,GAAG,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { ComputedDependence } from "./computedUpdater";
|
|
2
|
-
// 相同依赖去重
|
|
3
|
-
function sameDependences(dependences: ComputedDependence[]) {
|
|
4
|
-
for (let f = 0; f < dependences.length; f++) {
|
|
5
|
-
const firstPath = dependences[f].paths.toString();
|
|
6
|
-
for (let i = f + 1; i < dependences.length; i++) {
|
|
7
|
-
const curPath = dependences[i].paths.toString();
|
|
8
|
-
if (firstPath === curPath) {
|
|
9
|
-
dependences.splice(f, 1);
|
|
10
|
-
|
|
11
|
-
return sameDependences(dependences);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return dependences;
|
|
17
|
-
}
|
|
18
|
-
// 当前依赖是上一个依赖的子依赖时,去除上一个依赖
|
|
19
|
-
function serialDependences(dependences: ComputedDependence[], basePath: string[]) {
|
|
20
|
-
const lastDependence = dependences[dependences.length - 1];
|
|
21
|
-
if (lastDependence.paths.toString() === basePath.toString()) {
|
|
22
|
-
dependences.pop();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return dependences;
|
|
26
|
-
}
|
|
27
|
-
// -2依赖 + -1val === 当前依赖 去除-2依赖
|
|
28
|
-
function separatedDependences(dependences: ComputedDependence[], basePath: string[], prop: string) {
|
|
29
|
-
const lastDependence = dependences[dependences.length - 1].val;
|
|
30
|
-
if (
|
|
31
|
-
typeof lastDependence === "string"
|
|
32
|
-
&& dependences[dependences.length - 2].paths.concat(lastDependence).toString()
|
|
33
|
-
=== basePath.concat(prop).toString()
|
|
34
|
-
) {
|
|
35
|
-
dependences.splice(dependences.length - 2, 1);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return dependences;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 依赖去重
|
|
43
|
-
*/
|
|
44
|
-
export function uniqueDependences(
|
|
45
|
-
dependences: ComputedDependence[],
|
|
46
|
-
basePath: string[],
|
|
47
|
-
prop: string,
|
|
48
|
-
): ComputedDependence[] {
|
|
49
|
-
if (dependences.length === 0) return dependences;
|
|
50
|
-
// 相同依赖去重 例如 [{path:['a','b']}, {path:['a','b']}] => [{path:['a','b'] }]
|
|
51
|
-
dependences = sameDependences(dependences);
|
|
52
|
-
|
|
53
|
-
// 连续依赖去除 当前依赖是上一个依赖的子依赖时,去除上一个依赖
|
|
54
|
-
dependences = serialDependences(dependences, basePath);
|
|
55
|
-
|
|
56
|
-
// -2依赖 + -1依赖 === 当前依赖 去除-2依赖
|
|
57
|
-
if (dependences.length >= 2) {
|
|
58
|
-
dependences = separatedDependences(dependences, basePath, prop);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return dependences;
|
|
62
|
-
}
|
|
63
|
-
// import type { ComputedDependence } from "./computedUpdater";
|
|
64
|
-
// export /**
|
|
65
|
-
// * 依赖去重
|
|
66
|
-
// * @example
|
|
67
|
-
// * ```ts
|
|
68
|
-
// * const dependences = [{path:['a','b']}, {path:['a','b','c']}, {path:['d','e']}, {path:['d']}]
|
|
69
|
-
// * const result = uniqueDependences(dependences)
|
|
70
|
-
// * // result = [{path:['a','b'] } ,{ path:['d'] }]
|
|
71
|
-
// * ```
|
|
72
|
-
// */
|
|
73
|
-
// function uniqueDependences(dependences: ComputedDependence[]): ComputedDependence[] {
|
|
74
|
-
// if (dependences.length === 1) return dependences;
|
|
75
|
-
// console.log("外部去重前", dependences);
|
|
76
|
-
|
|
77
|
-
// for (let f = 0; f < dependences.length; f++) {
|
|
78
|
-
// const firstPath = dependences[f].paths.join(".") + ".";
|
|
79
|
-
// for (let i = f + 1; i < dependences.length; i++) {
|
|
80
|
-
// const curPath = dependences[i].paths.join(".") + ".";
|
|
81
|
-
// if (firstPath.startsWith(curPath)) {
|
|
82
|
-
// // 例如 path[0] = 'a.b.c.',curPath = 'a.b.'
|
|
83
|
-
// dependences.splice(f, 1);
|
|
84
|
-
|
|
85
|
-
// return uniqueDependences(dependences);
|
|
86
|
-
// }
|
|
87
|
-
// if (curPath.startsWith(firstPath)) {
|
|
88
|
-
// // 例如 curPath = 'a.b.' path[0] = 'a.b.c.',
|
|
89
|
-
// dependences.splice(i, 1);
|
|
90
|
-
|
|
91
|
-
// return uniqueDependences(dependences);
|
|
92
|
-
// }
|
|
93
|
-
// }
|
|
94
|
-
// }
|
|
95
|
-
// console.log("外部去重后", dependences);
|
|
96
|
-
|
|
97
|
-
// return dependences;
|
|
98
|
-
// }
|