From 4db9d2e70a7b06a8dce6a5add2e3a804b422fea1 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Tue, 29 Aug 2023 09:44:31 +0800 Subject: [PATCH] react router --- src/App.jsx | 6 ++++-- src/components/Add.jsx | 5 +++++ src/main.jsx | 19 +++++++++++-------- src/router/index.jsx | 13 +++++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/components/Add.jsx create mode 100644 src/router/index.jsx diff --git a/src/App.jsx b/src/App.jsx index c018b2a..bc66500 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -6,6 +6,8 @@ import { TeamOutlined, UserOutlined, } from '@ant-design/icons' +import { useRoutes } from 'react-router-dom' +import routes from './router/index' import { Breadcrumb, Layout, Menu, theme } from 'antd' const { Header, Content, Footer, Sider } = Layout import Login from '@/views/Login' @@ -36,7 +38,7 @@ const App = () => { const { countStore } = useRootStore() const { count } = countStore const [collapsed, setCollapsed] = useState(false) - const [isLogin, setIsLogin] = useState(false) + const [isLogin, setIsLogin] = useState(true) const { token: { colorBgContainer }, } = theme.useToken() @@ -97,7 +99,7 @@ const App = () => { background: colorBgContainer, }} > - Bill is a cat. + {useRoutes(routes)}