初始化
This commit is contained in:
39
src/App.jsx
Normal file
39
src/App.jsx
Normal file
@ -0,0 +1,39 @@
|
||||
import './App.css';
|
||||
import {ConfigProvider} from "antd";
|
||||
import locale from 'antd/locale/zh_CN';
|
||||
import {useEffect, useState} from "react";
|
||||
import {BrowserRouter as Router} from "react-router-dom";
|
||||
import Routers from "./routes";
|
||||
|
||||
|
||||
function App() {
|
||||
|
||||
const [height, setHeight] = useState(window.innerHeight)
|
||||
|
||||
useEffect(() => {
|
||||
setHeight(window.innerHeight)
|
||||
window.addEventListener('resize', handleResize);
|
||||
}, []);
|
||||
|
||||
const handleResize = () => {
|
||||
setHeight(window.innerHeight)
|
||||
}
|
||||
|
||||
return (
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
token: {
|
||||
colorPrimary: '#980000'
|
||||
}
|
||||
}}
|
||||
locale={locale}>
|
||||
<div className="App" style={{height: height}}>
|
||||
<Router>
|
||||
<Routers/>
|
||||
</Router>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user