diff --git a/.prettierrc b/.prettierrc index ff5c734..696b19a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,7 @@ "trailingComma": "all", "arrowParens": "avoid", "tabWidth": 2, - "endOfLine": "lf" + "endOfLine": "lf", + "jsxSingleQuote": true, + "jsxBracketSameLine": false } diff --git a/package.json b/package.json index edff1e4..52ab708 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", + "prettier": "^3.0.2", "vite": "^4.4.5" } } diff --git a/src/App.jsx b/src/App.jsx index 871539b..f604890 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,11 +1,21 @@ -import {Button} from 'antd' +import { Component } from 'react' +import { Button } from 'antd' +import { Routes, Route } from 'react-router-dom' -function App() { - return ( - <> - - - ) +const Home = () => { + return
首页
+} +const About = () => { + return
关于
} -export default App +export default class App extends Component { + render() { + return ( + + }> + }> + + ) + } +} diff --git a/src/main.jsx b/src/main.jsx index 54b39dd..a97bc0d 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,10 +1,13 @@ import React from 'react' import ReactDOM from 'react-dom/client' +import {BrowserRouter as Router} from "react-router-dom"; import App from './App.jsx' import './index.css' ReactDOM.createRoot(document.getElementById('root')).render( - - - , + + + + + ) diff --git a/yarn.lock b/yarn.lock index f897b8e..fc1b484 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1893,6 +1893,11 @@ prelude-ls@^1.2.1: resolved "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier@^3.0.2: + version "3.0.2" + resolved "https://registry.npmmirror.com/prettier/-/prettier-3.0.2.tgz#78fcecd6d870551aa5547437cdae39d4701dca5b" + integrity sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ== + prop-types@^15.8.1: version "15.8.1" resolved "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"