Skip to content

Commit

Permalink
feat: 添加菜单
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivocin committed Feb 25, 2021
1 parent d5aaf8a commit 728acc2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
20 changes: 8 additions & 12 deletions vite-react/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from 'react'
import { DatePicker } from 'antd'
import logo from './logo.svg'
import './App.css'
import 'antd/dist/antd.less'
import React, { useState } from "react";
import { DatePicker, Menu } from "antd";
import logo from "./logo.svg";
import "./App.css";

function App() {
const [count, setCount] = useState(0)
const [count, setCount] = useState(0);

return (
<div className="App">
Expand All @@ -18,9 +17,6 @@ function App() {
count is: {count}
</button>
</p>
<p>
Edit <code>App.jsx</code> and save to test HMR updates.
</p>
<p>
<a
className="App-link"
Expand All @@ -30,7 +26,7 @@ function App() {
>
Learn React
</a>
{' | '}
{" | "}
<a
className="App-link"
href="https://vitejs.dev/guide/features.html"
Expand All @@ -42,7 +38,7 @@ function App() {
</p>
</header>
</div>
)
);
}

export default App
export default App;
13 changes: 13 additions & 0 deletions vite-react/src/Layout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import { Menu } from "antd";
import { Link } from "react-router-dom";

export default function Layout() {
return (
<Menu selectedKeys="App" mode="horizontal">
<Menu.Item key="App">
<Link to="/app">App</Link>
</Menu.Item>
</Menu>
);
}
3 changes: 3 additions & 0 deletions vite-react/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from "react";
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
import Layout from "./Layout";
import App from "./App";
import "antd/dist/antd.less";

export default function Index() {
return (
<Router>
<Layout />
<Switch>
<Route path="/app">
<App />
Expand Down

0 comments on commit 728acc2

Please sign in to comment.