diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..55712c1
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "typescript.tsdk": "node_modules/typescript/lib"
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 550f4d5..04b0d64 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2275,7 +2275,7 @@
},
"@typescript-eslint/eslint-plugin": {
"version": "4.6.1",
- "resolved": "https://registry.npm.taobao.org/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-4.6.1.tgz?cache=0&sync_timestamp=1604339645055&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40typescript-eslint%2Feslint-plugin%2Fdownload%2F%40typescript-eslint%2Feslint-plugin-4.6.1.tgz",
+ "resolved": "https://registry.npm.taobao.org/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-4.6.1.tgz",
"integrity": "sha1-mdd+t6AW/VpedJ0sRKfkwxfrfaM=",
"requires": {
"@typescript-eslint/experimental-utils": "4.6.1",
@@ -5349,9 +5349,9 @@
}
},
"eslint": {
- "version": "7.12.1",
- "resolved": "https://registry.npm.taobao.org/eslint/download/eslint-7.12.1.tgz?cache=0&sync_timestamp=1603768145986&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint%2Fdownload%2Feslint-7.12.1.tgz",
- "integrity": "sha1-vZqB+memz9UWVs24iBLOSczsWAE=",
+ "version": "7.13.0",
+ "resolved": "https://registry.npm.taobao.org/eslint/download/eslint-7.13.0.tgz",
+ "integrity": "sha1-fxgBJsDc3vMnv7VLIR14At7MCNo=",
"requires": {
"@babel/code-frame": "^7.0.0",
"@eslint/eslintrc": "^0.2.1",
@@ -6212,7 +6212,7 @@
},
"file-entry-cache": {
"version": "5.0.1",
- "resolved": "https://registry.npm.taobao.org/file-entry-cache/download/file-entry-cache-5.0.1.tgz",
+ "resolved": "https://registry.npm.taobao.org/file-entry-cache/download/file-entry-cache-5.0.1.tgz?cache=0&sync_timestamp=1604832267816&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffile-entry-cache%2Fdownload%2Ffile-entry-cache-5.0.1.tgz",
"integrity": "sha1-yg9u+m3T1WEzP7FFFQZcL6/fQ5w=",
"requires": {
"flat-cache": "^2.0.1"
@@ -6308,7 +6308,7 @@
},
"flat-cache": {
"version": "2.0.1",
- "resolved": "https://registry.npm.taobao.org/flat-cache/download/flat-cache-2.0.1.tgz",
+ "resolved": "https://registry.npm.taobao.org/flat-cache/download/flat-cache-2.0.1.tgz?cache=0&sync_timestamp=1604831838291&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fflat-cache%2Fdownload%2Fflat-cache-2.0.1.tgz",
"integrity": "sha1-XSltbwS9pEpGMKMBQTvbwuwIXsA=",
"requires": {
"flatted": "^2.0.0",
@@ -11472,6 +11472,12 @@
"resolved": "https://registry.npm.taobao.org/prepend-http/download/prepend-http-1.0.4.tgz",
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
},
+ "prettier": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npm.taobao.org/prettier/download/prettier-2.1.2.tgz?cache=0&sync_timestamp=1600215482255&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprettier%2Fdownload%2Fprettier-2.1.2.tgz",
+ "integrity": "sha1-MFBwDa4uTItnxMP2Zs24r0BeHOU=",
+ "dev": true
+ },
"pretty-bytes": {
"version": "5.4.1",
"resolved": "https://registry.npm.taobao.org/pretty-bytes/download/pretty-bytes-5.4.1.tgz",
diff --git a/package.json b/package.json
index 4eed9d0..9b1e262 100644
--- a/package.json
+++ b/package.json
@@ -44,5 +44,12 @@
"last 1 firefox version",
"last 1 safari version"
]
+ },
+ "devDependencies": {
+ "@typescript-eslint/eslint-plugin": "^4.6.1",
+ "@typescript-eslint/parser": "^4.6.1",
+ "eslint": "^7.13.0",
+ "eslint-plugin-react": "^7.21.5",
+ "prettier": "2.1.2"
}
}
diff --git a/src/pages/home.tsx b/src/pages/home.tsx
index 3aa019f..5bd9f76 100644
--- a/src/pages/home.tsx
+++ b/src/pages/home.tsx
@@ -1,83 +1,70 @@
-import React from 'react';
-import { Button, Layout, Menu } from 'antd';
+import React from "react";
+import { Button, Layout, Menu } from "antd";
import {
- MenuUnfoldOutlined,
- MenuFoldOutlined,
- UserOutlined,
- VideoCameraOutlined,
- UploadOutlined,
- LeftCircleFilled,
-} from '@ant-design/icons';
+ MenuUnfoldOutlined,
+ MenuFoldOutlined,
+ UserOutlined,
+ VideoCameraOutlined,
+ UploadOutlined,
+ LeftCircleFilled,
+} from "@ant-design/icons";
import "./home.css";
-import ContentTabs from './tabs';
-import { HashRouter, Link, Redirect, Route, Switch} from 'react-router-dom';
-import { any } from 'prop-types';
-
+import ContentTabs from "./tabs";
+import { HashRouter, Link, Redirect, Route, Switch } from "react-router-dom";
+import { Console } from "console";
const { Header, Sider, Content } = Layout;
class Home extends React.Component {
- state = {
- collapsed: false,
- };
+ state = {
+ collapsed: false,
+ };
- toggle = () => {
- this.setState({
- collapsed: !this.state.collapsed,
- });
- };
+ toggle = () => {
+ this.setState({
+ collapsed: !this.state.collapsed,
+ });
+ return;
+ };
- render() {
- var props:any = this.props;
- const { match } = props;
- console.log();
- return (
- // var props:any = this.props;
-
-
+ render() {
+ const props: any = this.props;
+ const { match } = props;
+ console.log("home");
+ return (
+ // var props:any = this.props;
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- ...{console.log("tab1 redirect")}
-
-
- {/* */}
-
-
-
-
-
-
- );
- }
+
+
+ {/* */}
+
+
+ ...{console.log("redirect tab1")}
+
+
+
+
+
+
+
+
+ );
+ }
}
-export default Home;
\ No newline at end of file
+export default Home;
diff --git a/src/pages/tabs.tsx b/src/pages/tabs.tsx
index 0e34806..06e4e08 100644
--- a/src/pages/tabs.tsx
+++ b/src/pages/tabs.tsx
@@ -1,37 +1,47 @@
-import { AndroidOutlined, AppleOutlined } from '@ant-design/icons';
-import { Tabs } from 'antd';
-import React from 'react';
+import { AndroidOutlined, AppleOutlined } from "@ant-design/icons";
+import { Tabs } from "antd";
+import React from "react";
const { TabPane } = Tabs;
class ContentTabs extends React.Component {
-
+ render() {
+ const props: any = this.props;
-
- render() {
- var props:any = this.props;
- const {location, match} = props;
- const {state} = location;
- console.log(props);
- var key = match.params.id;
- console.log(key);
+ const { match } = props;
+ // const {state} = location;
+ // console.log(props);
+ const key = match.params.id === undefined ? "tab1" : match.params.id;
- return (
-
- Tab 1}
- key="tab1"
- >
- Tab 1
-
- Tab 2}
- key="tab2"
- >
- Tab 2
-
-
- )
- }
+ console.log(key);
+
+ return (
+
+
+
+ Tab 1
+
+ }
+ key="tab1"
+ >
+ Tab 1
+
+
+
+ Tab 2
+
+ }
+ key="tab2"
+ >
+ Tab 2
+
+
+ );
+ }
}
-export default ContentTabs;
\ No newline at end of file
+export default ContentTabs;
diff --git a/src/router/router.tsx b/src/router/router.tsx
index 2195125..e479b61 100644
--- a/src/router/router.tsx
+++ b/src/router/router.tsx
@@ -1,35 +1,28 @@
-
-import React from 'react';
-import { BrowserRouter, Route, Switch, HashRouter, Redirect, Link } from 'react-router-dom';
+import React from "react";
+import {
+ BrowserRouter,
+ Route,
+ Switch,
+ HashRouter,
+ Redirect,
+ Link,
+} from "react-router-dom";
-
-import Home from '../pages/home';
+import Home from "../pages/home";
class HomeRouter extends React.Component {
-
- render() {
- return (
-
-
-
-
-
- ...{console.log("redirect")}
-
-
-
-
-
-
-
-
-
- {/* */}
-
-
- )
- }
-}
+ render() {
+ return (
+
+
+
+ ...{console.log("redirect")}
+
+
+
+
+ );
+ }
+}
export default HomeRouter;
-