feat:init

This commit is contained in:
zhongyidian committed 2025-12-29 19:19:10 +08:00
1 parent 53d0eeac6b
commit ae0c050010
494 files changed
+17701 -2318

No files matched your search

+25 -6
View File
@@ -1,11 +1,30 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App';
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App";
const rootElement = document.getElementById('root');
// 在开发模式的移动端启用 vConsole(需先安装 vconsole 依赖)
if (import.meta.env.DEV && typeof window !== "undefined") {
const ua = window.navigator.userAgent.toLowerCase();
const isMobile = /iphone|ipad|ipod|android|mobile/.test(ua);
if (isMobile) {
// 动态加载,避免生产环境打包 & 未安装时报错
import("vconsole")
.then((mod) => {
const VConsole = (mod as any).default || (mod as any);
// eslint-disable-next-line no-new
new VConsole();
})
.catch(() => {
// vconsole 未安装或加载失败时静默忽略
});
}
}
const rootElement = document.getElementById("root");
if (!rootElement) {
throw new Error('Root element not found');
throw new Error("Root element not found");
}
createRoot(rootElement).render(