|
@@ -2,21 +2,21 @@ import React from 'react';
|
|
|
import ReactDOM from 'react-dom/client';
|
|
import ReactDOM from 'react-dom/client';
|
|
|
import './index.css';
|
|
import './index.css';
|
|
|
import reportWebVitals from './reportWebVitals';
|
|
import reportWebVitals from './reportWebVitals';
|
|
|
-import {createBrowserRouter, RouterProvider} from 'react-router-dom';
|
|
|
|
|
-
|
|
|
|
|
|
|
+import { RouterProvider} from 'react-router-dom';
|
|
|
|
|
+import router from './router';
|
|
|
// 定义路由表
|
|
// 定义路由表
|
|
|
-const routes = [
|
|
|
|
|
- {
|
|
|
|
|
- path:'/',
|
|
|
|
|
- element: <div>首页</div>
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path:'/my',
|
|
|
|
|
- element:<h1>我的</h1>
|
|
|
|
|
- }
|
|
|
|
|
-];
|
|
|
|
|
|
|
+// const routes = [
|
|
|
|
|
+// {
|
|
|
|
|
+// path:'/',
|
|
|
|
|
+// element: <div>首页</div>
|
|
|
|
|
+// },
|
|
|
|
|
+// {
|
|
|
|
|
+// path:'/my',
|
|
|
|
|
+// element:<h1>我的</h1>
|
|
|
|
|
+// }
|
|
|
|
|
+// ];
|
|
|
// 创建路由表
|
|
// 创建路由表
|
|
|
-const router = createBrowserRouter(routes);
|
|
|
|
|
|
|
+// const router = createBrowserRouter(routes);
|
|
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
|
root.render(
|
|
root.render(
|
|
|
<React.StrictMode>
|
|
<React.StrictMode>
|