Compare commits
8 Commits
1-模板约定
...
9-antd-pro
Author | SHA1 | Date | |
---|---|---|---|
e01a2f5348 | |||
e8729a499a | |||
1a1cd5d8d3 | |||
b15f09c27c | |||
b051c59e9e | |||
653fc7b09d | |||
620154793b | |||
e9557c1ef3 |
12
README.md
12
README.md
@@ -1,15 +1,5 @@
|
||||
# umi project
|
||||
|
||||
## Getting Started
|
||||
|
||||
Install dependencies,
|
||||
http://localhost:3000/api/users
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
Start the dev server,
|
||||
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
@@ -1,13 +1,10 @@
|
||||
import { defineConfig } from 'umi';
|
||||
|
||||
import routes from './routes'
|
||||
export default defineConfig({
|
||||
nodeModulesTransform: {
|
||||
type: 'none', // all 慢 兼容好
|
||||
},
|
||||
routes: [
|
||||
{ path: '/', component: '@/pages/index' },
|
||||
{ path: '/about', component: '@/pages/about' },
|
||||
],
|
||||
routes,
|
||||
fastRefresh: {},
|
||||
history: {
|
||||
type: 'browser'
|
||||
@@ -20,4 +17,22 @@ export default defineConfig({
|
||||
favicon: '/favicon.ico',// 网站图标
|
||||
dynamicImport: {}, // 按需加载
|
||||
mountElementId: 'root', // 指定 reactapp 渲染到元素的根元素 id
|
||||
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://127.0.0.1:8989'
|
||||
},
|
||||
},
|
||||
|
||||
// 主题
|
||||
theme: {
|
||||
// '@primary-color': 'red',
|
||||
},
|
||||
// https://v3.umijs.org/zh-CN/plugins/plugin-layout
|
||||
layout: {
|
||||
name: 'Umi.js',
|
||||
locale: true,
|
||||
layout: 'side',
|
||||
logo: '/user.jpg',
|
||||
},
|
||||
});
|
||||
|
4
config/routes.ts
Normal file
4
config/routes.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default [
|
||||
{ path: '/', component: '@/pages/index', name: '首页' },
|
||||
{ path: '/about', component: '@/pages/about', name: '关于' },
|
||||
]
|
7
mock/api.ts
Normal file
7
mock/api.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
// 支持值为 Object 和 Array
|
||||
'GET /api/users': { users: [1, 2] },
|
||||
|
||||
// GET 可忽略
|
||||
'/api/users/1': { id: 1 },
|
||||
}
|
@@ -28,7 +28,7 @@
|
||||
"devDependencies": {
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@umijs/preset-react": "1.x",
|
||||
"@umijs/preset-react": "latest",
|
||||
"@umijs/test": "^3.5.41",
|
||||
"lint-staged": "^10.0.7",
|
||||
"prettier": "^2.2.0",
|
||||
|
BIN
public/user.jpg
Normal file
BIN
public/user.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/user.jpg
Normal file
BIN
src/assets/user.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@@ -1,9 +1,10 @@
|
||||
import styles from './index.less';
|
||||
|
||||
import { Button } from 'antd'
|
||||
export default function IndexPage() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page index</h1>
|
||||
<Button type={"primary"}>Click</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user