Open liam61 opened 4 years ago
@lawler61 if you see 5vw from 16px, then 16 / 5 * 100 = 320 (viewportWidth). 320 — default viewportWidth. Your settings did not apply. Show your config widely, with context.
@lawler61 if you see 5vw from 16px, then 16 / 5 * 100 = 320 (viewportWidth). 320 — default viewportWidth. Your settings did not apply. Show your config widely, with context.
thanks for your reminder, i use this in Taro framework as custom portcss plugins and set it in config/index file which like this
const config = {
projectName: 'mini',
date: '2019-9-8',
designWidth: 375,
deviceRatio: {
'375': 1 / 2,
'640': 2.34 / 2,
'750': 1,
'828': 1.81 / 2,
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: {
babel: {...},
},
weapp: {
module: {
postcss: {
autoprefixer: {
enable: true,
config: {
browsers: ['last 3 versions', 'Android >= 4.1', 'ios >= 8'],
},
},
pxtransform: {
enable: false,
},
'postcss-px-to-viewport': {
enable: true,
config: {
viewportWidth: 375,
viewportUnit: 'vw',
// minPixelValue: 1,
selectorBlackList: ['.ignore'],
},
},
url: {...},
cssModules: {...},
},
},
},
h5: {...},
}
and i put px-vw settings in the config object, and i works fine now~
hi, i set viewportWidth: 375 and then run in the phone 6 simulator whose width is exactly 375, then i set font-size: 16px, but end up in 5vw, the right value should be 16 / 3.75 = 4.276. please help me out, thanks. here's my code