main.tsx 629 B

123456789101112131415161718192021222324252627
  1. import { StrictMode } from "react";
  2. import { createRoot } from "react-dom/client";
  3. import App from "./App.tsx";
  4. import "./index.css";
  5. // 移除首次加载的 loading
  6. const removeAppLoading = () => {
  7. const loadingElement = document.getElementById("app-loading");
  8. if (loadingElement) {
  9. loadingElement.style.opacity = "0";
  10. loadingElement.style.transition = "opacity 0.3s ease-out";
  11. setTimeout(() => {
  12. loadingElement.remove();
  13. }, 300);
  14. }
  15. };
  16. createRoot(document.getElementById("root")!).render(
  17. <StrictMode>
  18. <App />
  19. </StrictMode>
  20. );
  21. // React 渲染完成后移除 loading
  22. removeAppLoading();