使用React js完成web前端

This commit is contained in:
LIm1tZz7 committed 2026-09-27 22:08:23 +08:00
1 parent 9e8c5f1ef0
commit 7600f0f9ed
130 files changed
+12708 -788

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { spawn } from 'node:child_process';
// 用系统默认浏览器打开本地地址,并校验 URL 合法性。
export function openBrowser(url) {
if (!/^http:\/\/[A-Za-z0-9.:[\]-]+:\d+\/$/.test(url)) throw new Error('Refusing to open an invalid local URL.');
const command = process.platform === 'win32' ? 'cmd.exe' : process.platform === 'darwin' ? 'open' : 'xdg-open';
const args = process.platform === 'win32' ? ['/d', '/s', '/c', 'start', '', url] : [url];
const child = spawn(command, args, { detached: true, stdio: 'ignore', windowsHide: true });
child.unref();
}