index.jsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { lazy } from "solid-js";
  2. import { render } from "solid-js/web";
  3. import { Router, useRoutes, hashIntegration } from "@solidjs/router";
  4. // import { Router } from "solid-app-router";
  5. // import Routers from "./router/index";
  6. const routes = [
  7. {
  8. path: "/",
  9. component: lazy(() => import("./pages/BigScreen/Home"))
  10. },
  11. {
  12. path: "/common",
  13. component: lazy(() => import("./pages/CommonBigScreen/Home"))
  14. }
  15. ];
  16. import utils from "./utils/index"
  17. import "./assets/style/layout.css"
  18. import "./assets/style/base.css"
  19. window.onresize = function () {
  20. utils.screenSize()
  21. }
  22. // 兼容requestAnimFrame
  23. window.requestAnimFrame = (function () {
  24. return window.requestAnimationFrame ||
  25. window.webkitRequestAnimationFrame ||
  26. window.mozRequestAnimationFrame ||
  27. function (callback) {
  28. window.setTimeout(callback, 60000 / 60);
  29. };
  30. })();
  31. window.cancelrequestAnimFrame = (function () {
  32. return window.cancelAnimationFrame ||
  33. window.webkitCancelAnimationFrame ||
  34. window.mozCancelAnimationFrame ||
  35. function (ID) {
  36. window.clearTimeout(ID);
  37. };
  38. })();
  39. render(() => {
  40. // 初始化根字体
  41. utils.screenSize()
  42. const Routes = useRoutes(routes);
  43. return (
  44. // <Router>
  45. // <Routers />
  46. // </Router>
  47. <Router source={hashIntegration()}>
  48. <Routes />
  49. </Router>
  50. )
  51. }, document.getElementById("root"));