5 Commits

Author SHA1 Message Date
e01a2f5348 feat: init 2023-10-01 13:25:41 +08:00
e8729a499a feat: init 2023-10-01 13:16:11 +08:00
1a1cd5d8d3 feat: init 2023-10-01 01:37:49 +08:00
b15f09c27c feat: init 2023-10-01 01:36:39 +08:00
b051c59e9e feat: init 2023-10-01 01:26:04 +08:00
4 changed files with 30 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
# 默认全局
src/global.less
http://localhost:3000/api/users

View File

@@ -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'
@@ -21,8 +18,21 @@ export default defineConfig({
dynamicImport: {}, // 按需加载
mountElementId: 'root', // 指定 reactapp 渲染到元素的根元素 id
proxy: {
'/api': {
target: 'https://127.0.0.1:8989'
},
},
// 主题
theme: {
'@primary-color': 'red',
// '@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
View File

@@ -0,0 +1,4 @@
export default [
{ path: '/', component: '@/pages/index', name: '首页' },
{ path: '/about', component: '@/pages/about', name: '关于' },
]

7
mock/api.ts Normal file
View File

@@ -0,0 +1,7 @@
export default {
// 支持值为 Object 和 Array
'GET /api/users': { users: [1, 2] },
// GET 可忽略
'/api/users/1': { id: 1 },
}