总结:
调整config/config.ts内配置(如:history和publicPath 会影响打包、如:proxy影响接口请求)
调整config/proxy.ts 内配置(调整接口代理地址)
调整src/app.tsx 内配置 (如:对账号信息权限校验 重定向history、如baseURL)
调整src/requestErrorConfig.ts (如果token活请求heard头配置等...)
登录页 src/pages/user/login/index.tsx 中 handleSubmit方法为登录函数
右上角信息状态栏 src/components/RightContent/AvatarDropdown.tsx 账号信息
备份初始化文件:
config/config.ts:
// https://umijs.org/config/
import { defineConfig } from '@umijs/max';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';
// const { REACT_APP_ENV = "dev" } = process.env;
const { REACT_APP_ENV } = process.env;
export default defineConfig({
/**
* @name 开启 hash 模式
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
* @doc https://umijs.org/docs/api/config#hash
*/
hash: true,
history: {
type: 'hash'
},
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
/**
* @name 兼容性设置
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
* @doc https://umijs.org/docs/api/config#targets
*/
// targets: {
// ie: 11,
// },
/**
* @name 路由的配置,不在路由中引入的文件不会编译
* @description 只支持 path,component,routes,redirect,wrappers,title 的配置
* @doc https://umijs.org/docs/guides/routes
*/
// umi routes: https://umijs.org/docs/routing
routes,
/**
* @name 主题的配置
* @description 虽然叫主题,但是其实只是 less 的变量设置
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
* @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme
*/
theme: {
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
// 只有设置为 variable, 才能使用 configProvide 动态设置主色调
'root-entry-name': 'variable',
},
/**
* @name moment 的国际化配置
* @description 如果对国际化没有要求,打开之后能减少js的包大小
* @doc https://umijs.org/docs/api/config#ignoremomentlocale
*/
ignoreMomentLocale: tr

最低0.47元/天 解锁文章
537

被折叠的 条评论
为什么被折叠?



