AntdPro框架下载后 部分重要初始化文件配置

 总结:

调整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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值