From e0500fd6e864122fa4e1e67726e2dbae57184677 Mon Sep 17 00:00:00 2001 From: MrKBear Date: Sun, 6 Feb 2022 00:29:58 +0800 Subject: [PATCH] Mod Entry --- source/Page/Entry/Entry.scss | 12 ++++++++++++ source/Page/Entry/Entry.tsx | 16 +++++++++++++--- source/Page/Laboratory/Laboratory.tsx | 7 ++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/source/Page/Entry/Entry.scss b/source/Page/Entry/Entry.scss index e69de29..27aedbf 100644 --- a/source/Page/Entry/Entry.scss +++ b/source/Page/Entry/Entry.scss @@ -0,0 +1,12 @@ +html { + font-family: sans-serif; + font-size: 100%; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; +} + +body{ + margin: 0; + padding: 0; + border: 0; +} \ No newline at end of file diff --git a/source/Page/Entry/Entry.tsx b/source/Page/Entry/Entry.tsx index 25e4027..2bcd763 100644 --- a/source/Page/Entry/Entry.tsx +++ b/source/Page/Entry/Entry.tsx @@ -1,5 +1,6 @@ -import { Component, ReactNode, StrictMode } from "react"; +import { Component, ReactNode, StrictMode, FunctionComponent } from "react"; import { render } from "react-dom"; +import "./Entry.scss"; class Entry extends Component<{}, {}> { @@ -15,6 +16,15 @@ class Entry extends Component<{}, {}> { * 渲染组件 * @param component 需要渲染的组件 */ - public static renderComponent(component: new () => Component) { + public static renderComponent( + RenderComponent: (new (...p: any) => Component) | FunctionComponent + ) { + render( + , + document.getElementById("root") + ); } -} \ No newline at end of file +} + +export default Entry; +export { Entry }; \ No newline at end of file diff --git a/source/Page/Laboratory/Laboratory.tsx b/source/Page/Laboratory/Laboratory.tsx index 7aa3df4..052dd31 100644 --- a/source/Page/Laboratory/Laboratory.tsx +++ b/source/Page/Laboratory/Laboratory.tsx @@ -1,6 +1,6 @@ import { Component, ReactNode, StrictMode } from "react"; -import { render } from "react-dom"; import { Group } from "@Model/Group"; +import { Entry } from "../Entry/Entry"; import "./Laboratory.scss"; class Test extends Component { @@ -12,9 +12,6 @@ class Test extends Component { } } -render( - , - document.getElementById("root") -); +Entry.renderComponent(Test); console.log(new Group); \ No newline at end of file