umi-plugin-antd-theme Usage Configure inconfig/theme.config.json, {"theme": [ {"theme":"dark","fileName":"dark.css"}, {"fileName":"mingQing.css","modifyVars": {"@primary-color":"#13C2C2"} } ],// 是否压缩css"min":true,// css module"isModule":true,// 忽略 antd 的依赖"...
在网上搜了挺多关于切换主题的文章,但是都觉得很麻烦,由于用了umi框架,翻了一下切换主题的相关插件,找到了umi-plugin-antd-theme,并看了一下源码,发现似乎很简单,只需要三步,唯一不喜欢的地方就是,umi-plugin-antd-theme读取的是json文件,样式复用不大方便。 ---分割线--- 以下是切换主题的配置步骤: 创建配置...
umi-plugin-antd-theme 虽然插件应该是为Ant Design Pro打造的但是Antd是一家,拿来开搞按照文档里说明的配置项目: yarn add umi-plugin-antd-theme -D 修改.umirc.js: plugins:[...other配置,['umi-plugin-antd-theme',{theme:[{key:'normal',fileName:'normal.css',modifyVars:{'@primary-color':'#0FC...
umi-plugin-dynamic-theme umi-plugin-antd-theme 的 fork 版本 Usage Configure inconfig/theme.config.json, {"theme": [ {"theme":"dark","fileName":"dark.css"}, {"fileName":"mingQing.css","modifyVars": {"@primary-color":"#13C2C2"} } ],// 是否压缩css"min":true,// css module"is...
umi-plugin-antd-theme Usage Configure inconfig/theme.config.json, {"theme": [ {"theme":"dark","fileName":"dark.css"}, {"fileName":"mingQing.css","modifyVars": {"@primary-color":"#13C2C2"} } ],// 是否压缩css"min":true,// css module"isModule":true,// 忽略 antd 的依赖"igno...
npm install -D umi-theme-webpack-plugin constAntDesignThemePlugin=require('umi-theme-webpack-plugin');constoptions={varFile:path.join(__dirname,"../../src/styles/variables.less"),antDir:path.join(__dirname,"../../node_modules/antd"),stylesDir:path.join(__dirname,"../../src/styles...
在umijs项目中引入antd,可以按照以下步骤进行: 安装antd库: 首先,你需要在你的项目中安装antd库。可以通过npm或yarn进行安装: bash npm install antd --save 或者 bash yarn add antd 在umijs项目中配置插件和主题: umijs支持通过插件来集成antd。你可以使用umi-plugin-react插件来自动处理antd的按需加载和样式...
是使用antd// theme: { '@primary-color': '#1DA57A' },//所有的主题色dva:{//dva的配置immer:{enableES5:true,enableAllPlugins:true,},},externals:{},publicPath:'/',//路由前缀base:'/',headScripts:[{src:'/autoSize.js'}],//head中需要读取的js,这里的autoSize是rem转化算法的jsantd:{//...
theme: { 'primary-color': layout.primaryColor, }, antd: {}, dva: { hmr: true, }, layout, routes, }); 由于对打包目录结构做了调整,调整为: ├── index.html └── static └── demo-web 故又添加了chainWebpack支持,内容如下: ...
接着我们需要安装两个依赖库来实现主题动态切换. 在powershell中执行如下代码. yarn add umi-plugin-antd-theme umi-plugin-setting-drawer 如图 安装好后,就成了如下内容 接着我们去app.tsx文件或者app.ts 在src根目录下.不能更改这个文件的名称.如图,找到如下函数 getInitialState ...