Comments (4)
请问这种还有其它方式进行更改样式吗
from antd-mobile-samples.
覆盖成功了,将antd-mobile-rn修改成antd-mobile,因为我的版本是2.1.8,在node_modules中还是antd-mobile形式的
const path = require('path');
const fs = require('fs');
// for 1.x
// const defaultVars = require('antd-mobile/lib/style/themes/default');
// for 2.x
const defaultVars = require('antd-mobile/lib/style/themes/default.native');
const customVars = require('../theme');
// for 1.x
// const themePath = path.resolve(require.resolve('antd-mobile'), '../style/themes/default.js');
// for 2.x
const themePath = path.resolve(require.resolve('antd-mobile'), '../style/themes/default.native.js');
const themeVars = Object.assign({}, defaultVars, customVars);
if (fs.statSync(themePath).isFile()) {
fs.writeFileSync(
themePath,
'var brandPrimary = "#108ee9"; var brandPrimaryTap = "#1284d6";module.exports = ' + JSON.stringify(themeVars)
);
}
我理解了一下,这种覆盖之后,你自己自定义的样式就是默认的样式,官方的样式已经不存在了,也就是说要想再次使用官方样式,你就得删掉node_modules并且重新install
from antd-mobile-samples.
看这里 Object.assign({}, defaultVars, customVars)
只是覆盖你自己设置的同名样式,其他不覆盖
from antd-mobile-samples.
version: "antd-mobile": "^2.1.8",
我重新install之后,
const defaultVars = require('antd-mobile/lib/style/themes/default.native');
default.native中的default.native不见了,我修改为default.less之后,报这样的错误
/Users/jkwu/WebStormProject/FLS_MW_APP/node_modules/antd-mobile/lib/style/themes/default.less:1
(function (exports, require, module, __filename, __dirname) { @hd: 1px; // 基本单位
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:74:10)
from antd-mobile-samples.
Related Issues (20)
- slider组件marks刻度分布有重叠现象
- .babelrc 文件找不到
- React.forwardRef is not a function
- Tabs 组件内使用RN官方的TextInput,第一次输入会隐藏键盘,我没有调用keyboard.dismiss(),debug和release都一样
- 文档已过期, 并且不维护, 建议 Archive
- select的下拉搜索问题
- Open tabs Allow setings
- SearchBar onCancel事件 不自动收缩input HOT 1
- 组件用到的图标不显示
- 安装link报错 HOT 1
- Action required: Greenkeeper could not be activated 🚨
- 3.0 之后定制主题的写法 HOT 2
- Any chance for Ant flutter package ?
- 编译警告 HOT 1
- Antd Mobile Next JS with theming - example
- can not open official website
- antd mobile DatePicker 动态设置时间选择范围 在IOS上 不能正确显示
- How to use ajax data to change theme?
- customize-cra 引用后相关更新说明文档中内容,是否与此demo不符
- Change the arrow of list.item to another picture HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antd-mobile-samples.