2.1.1 • Published 1 month ago

@antdp/config v2.1.1

Weekly downloads
9
License
ISC
Repository
github
Last release
1 month ago

@antdp/config

npm npm download

我们已将 umi 配置包裹了一层, 如果需要antdp中能使用自定义配置,你可以使用项目根目录的 config/config.ts/config/config.js进行配置

Installation

npm i @antdp/config --save-dev

Basic Usage

// config/config.{js|ts}

//二次封装的umi配置
import config from '@antdp/config';
// 路由数据
import router from './router.json';
/**开发代理配置*/
import proxy from './proxy';

export default config(router, {
  proxy,
});

Interface

import { IConfig, IRoute } from '@umijs/max';

export interface Options extends Omit<IConfig, 'routes'> {
  routes: IRoute;
}

export interface Config {
  (routes?: IRoute, optiosn?: Options): IConfig;
}

declare var config: Config;
export default config;

define配置

ANTD_IS_TABS

是否显示 Tab 选项卡,默认值true显示

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_IS_TABS: true
  },
);

ANTD_IS_IFRAME_RENDER

是否使用 iframe 展示内容,默认值true开启

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_IS_IFRAME_RENDER: true
  },
);

ANTD_IS_BREADCRUMB

是否展示面包屑, Tab 选项卡优先级大于面包屑

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_IS_BREADCRUMB: true
  },
);

ANTD_AUTH_CONF

是否开启权限验证 默认值false不启用

  • auth_menu 储存菜单路由权限---本地keys 默认值authMenu
  • auth_btn 储存按钮路径权限---本地keys 默认值 authBtn
  • auth_check_url 判断路径是否有权限的字段 默认值menuUrl,如果字段设置为undefinedauth_menuauth_btn储存形式为 ["/web"],反之储存形式为[{menuUrl:"/web"}],
import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_AUTH_CONF: {
+      auth_menu:"authMenu",
+      auth_btn:"authBtn",
+      auth_check_url:undefined
    }
  },
);

ANTD_MENU_IS_SHOW

是否显示 左侧菜单,默认值true

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_MENU_IS_SHOW: true
  },
);

ANTD_HEAD_IS_SHOW

是否显示 head头部,默认值true

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_HEAD_IS_SHOW: true
  },
);

ANTD_MENU_SEARCH_IS_SHOW

是否开启菜单栏搜索,默认值false

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {
+    ANTD_MENU_SEARCH_IS_SHOW: true
  },
);

locale配置

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
  locale: {
    // 默认使用 src/locales/zh-CN.ts 作为多语言文件
+    default: 'zh-CN',
+    antd: true,
    // default true, when it is true, will use `navigator.language` overwrite default
    // baseNavigator: true,
    /**
     * [国际化] 控制台提示 Warning: The current popular language does not exist, please check the locales folder! 警告信息
     * https://github.com/umijs/umi/issues/4363#issuecomment-616134434
     * 警用 `baseNavigator` 和 `title` 两个配置项 可以解决国际化警告问题
     */
+    baseNavigator: false,
+    title: false,
  },
  },
);

@umijs/max配置

request

开启 useRequestrequest,默认未开启

  • dataField 该配置的默认值是 data。该配置的主要目的是方便 useRequest 直接消费数据。如果你想要在消费数据时拿到后端的原始数据,需要在这里配置 dataField 为 ''
import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  request:{}
);

react-query

开启react-query,默认未开启

  • devtool: boolean,是否开启 react query 官方 devtool 工具,默认 true
  • queryClient: boolean, 是否注册全局的 QueryClient 和 QueryClientProvier,默认 true
import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  reactQuery: {
     // 是否开启 react query 官方 devtool 工具
+    devtool: false,
+    queryClient: true,
  },
);

useModel

开启useModel,默认未开启

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  model: {},
);

dva

开启dva,默认未开启

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  dva: {},
);

styled-components

styled-components 样式方案

  • babelPlugin: Object,开启 styled-components 的 babel 插件,仅 dev 模式有效 比如:
import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  styledComponents: {},
);

valtio

valtio 数据流方案

import config from '@antdp/config';
import proxy from './proxy';
import router from './router.json';
export default config(router, {
  proxy,
  define: {},
+  valtio: {},
);

更多配置参考 umi

2.1.1

1 month ago

2.1.0

1 month ago

2.0.24

1 month ago

2.0.23

6 months ago

2.0.22

7 months ago

2.0.21

9 months ago

2.0.15

11 months ago

2.0.16

11 months ago

2.0.13

11 months ago

2.0.14

11 months ago

2.0.19

11 months ago

2.0.17

11 months ago

2.0.18

11 months ago

2.0.20

11 months ago

2.0.3

12 months ago

2.0.2

1 year ago

2.0.5

12 months ago

2.0.4

12 months ago

2.0.7

12 months ago

2.0.6

12 months ago

2.0.9

12 months ago

2.0.8

12 months ago

2.0.1

1 year ago

1.9.1

12 months ago

1.9.0

12 months ago

2.0.11

12 months ago

2.0.12

12 months ago

2.0.10

12 months ago

2.0.0

1 year ago

2.0.0-bate.4.0

1 year ago

2.0.0-bate.5

1 year ago

2.0.0-bate.4

1 year ago

2.0.0-bate.3

1 year ago

1.8.25

1 year ago

1.8.26

1 year ago

1.8.27

1 year ago

2.0.0-bate6

1 year ago

2.0.0-bate-2

1 year ago

2.0.0-bate-4.1

1 year ago

2.0.0-bate-1

1 year ago

2.0.0-bate-0

1 year ago

1.8.20

2 years ago

1.8.21

2 years ago

1.8.22

2 years ago

1.8.23

2 years ago

1.8.24

2 years ago

1.8.17

2 years ago

1.8.18

2 years ago

1.8.19

2 years ago

1.8.16

3 years ago

1.8.15

3 years ago

1.8.14

3 years ago

1.8.13

3 years ago

1.8.12

3 years ago

1.8.11

3 years ago

1.8.9

3 years ago

1.8.10

3 years ago

1.8.8

3 years ago

1.8.7

3 years ago

1.8.6

3 years ago

1.8.2

3 years ago

1.8.5

3 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.19

3 years ago

1.6.17

3 years ago

1.6.16

3 years ago

1.6.18

3 years ago

1.6.15

3 years ago

1.6.14

3 years ago

1.6.11

3 years ago

1.6.13

3 years ago

1.6.4

3 years ago

1.6.10

3 years ago

1.6.9

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.0

3 years ago

1.5.4

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.12

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.6

4 years ago

1.2.0

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.19

4 years ago

1.1.20

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.13

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.10

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago