"添加前端模板和运行代码模块"
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { createHashRouter } from 'react-router-dom';
|
||||
import Home from '@/pages/Home';
|
||||
import ExamplesPage from '@/pages/ExamplesPage';
|
||||
import NotFound from '@/pages/NotFound';
|
||||
|
||||
/**
|
||||
* Hash-based routing (createHashRouter).
|
||||
* URLs look like `/#/…` and need no server rewrite rules.
|
||||
*
|
||||
* Why hash mode:
|
||||
* - Works on any static host without extra server config
|
||||
* - The fragment is not sent to the server
|
||||
* - Handy for static sites and CDNs
|
||||
*
|
||||
* Add a route:
|
||||
* {
|
||||
* path: '/your-path',
|
||||
* element: <YourComponent />,
|
||||
* }
|
||||
*/
|
||||
export const router = createHashRouter([
|
||||
{
|
||||
path: '/',
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: '/examples',
|
||||
element: <ExamplesPage />,
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <NotFound />,
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user