umi4 + antd-mobile5.27.0 怎么把antd的样式转成vw #5920
Unanswered
neptunedaxia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我目前使用的是postcss-px-to-viewport-8-plugin这个插件
在.umirc.ts里面这么配置的
const px2vw = require('postcss-px-to-viewport-8-plugin');
extraPostCSSPlugins: [
px2vw({
unitToConvert: 'px', // 要转化的单位
viewportWidth: 750, // 视窗的宽度,可根据自己的需求调整(这里是以PC端为例)
// viewportHeight: 1080, // 视窗的高度
unitPrecision: 6, // 转换后的精度,即小数点位数
propList: ['*'], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
viewportUnit: 'vw', // 指定需要转换成的视窗单位,默认vw
fontViewportUnit: 'vw', // 指定字体需要转换成的视窗单位,默认vw
// selectorBlackList: ['wrap'],// 指定不转换为视窗单位的类名,
minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
replace: true, // 是否转换后直接更换属性值
exclude: [], // 设置忽略文件,用正则做目录名匹配
landscape: false, // 是否处理横屏情况
}),
],
但是我只能把我代码里的px转成vw,antd-mobile 的样式无法转成vw
Beta Was this translation helpful? Give feedback.
All reactions