cdui-js 1.0.4 → 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/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "cdui-js",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
7
7
  "cdui-js": "./cli/bin.js"
8
8
  },
9
- "scripts": {
10
- },
9
+ "scripts": {},
11
10
  "dependencies": {
12
11
  "chalk": "^5.6.2",
13
12
  "commander": "^14.0.3",
@@ -21,4 +20,4 @@
21
20
  "@types/node": "^25.3.3",
22
21
  "typescript": "~5.6.2"
23
22
  }
24
- }
23
+ }
@@ -10,9 +10,9 @@ export interface SwitchProps {
10
10
  */
11
11
  component: () => JSX.Element;
12
12
  /**
13
- * 缓存 key
13
+ * 缓存 id
14
14
  */
15
- keepalive?: string;
15
+ id?: string;
16
16
  };
17
17
  }
18
18
 
@@ -30,14 +30,14 @@ export const Switch = (props: SwitchProps) => {
30
30
 
31
31
  return createMemo(() => {
32
32
  let branch = props.case;
33
- let keepalive;
33
+ let id;
34
34
 
35
35
  if (branch) {
36
- if ((keepalive = branch.keepalive)) {
36
+ if ((id = branch.id)) {
37
37
  return (
38
- roots[keepalive] ||
39
- (roots[keepalive] = createRoot((dispose) => {
40
- disposes[keepalive] = dispose;
38
+ roots[id] ||
39
+ (roots[id] = createRoot((dispose) => {
40
+ disposes[id] = dispose;
41
41
  return branch.component();
42
42
  }))
43
43
  );