Mod Entry

This commit is contained in:
2022-02-06 00:29:58 +08:00
parent 0d8ccf2b5f
commit e0500fd6e8
3 changed files with 27 additions and 8 deletions
+12
View File
@@ -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;
}
+13 -3
View File
@@ -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(
<Entry><RenderComponent/></Entry>,
document.getElementById("root")
);
}
}
}
export default Entry;
export { Entry };