Skip to content

Commit bd918e8

Browse files
committed
chore(code): optimize code
1 parent 5a7563e commit bd918e8

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/components/code-container/ata.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ export function createATA(onDownloadFile: (code: string, path: string) => void)
1414
return fetch(fetchUrl.href, init);
1515
},
1616
delegate: {
17-
receivedFile: (code, path) => {
18-
onDownloadFile(code, path);
19-
},
17+
receivedFile: onDownloadFile,
2018
},
2119
});
2220

src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
}
126126

127127
@layer base {
128+
/* 不能影响自定义的 scrollbar */
128129
*:not(.scrollbar) {
129130
scrollbar-width: thin;
130131
}

src/layout/root-preview/compiler.worker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function customResolver(files: MultipleFiles): PluginObj {
9494
}
9595

9696
function getModuleFile(files: MultipleFiles, modulePath: string) {
97-
let mouduleName = modulePath.split("./").pop() || "";
97+
let moduleName = modulePath.split("./").pop() || "";
9898
// 是相对路径: 导入的模块名称 eg: ./App.tsx --> App.tsx
9999
if (modulePath.includes(".")) {
100100
// 只识别以下几种文件类型: ts tsx js jsx
@@ -106,14 +106,14 @@ function getModuleFile(files: MultipleFiles, modulePath: string) {
106106
);
107107
})
108108
.find((key) => {
109-
return key.split(".").includes(mouduleName);
109+
return key.split(".").includes(moduleName);
110110
});
111111

112112
if (realModuleName) {
113-
mouduleName = realModuleName;
113+
moduleName = realModuleName;
114114
}
115115
}
116-
return files[mouduleName];
116+
return files[moduleName];
117117
}
118118

119119
function css2Js(file: CodeContainerFileInfo) {

0 commit comments

Comments
 (0)