优化移动端布局样式和配置
This commit is contained in:
@ -31,20 +31,25 @@ export default defineNuxtConfig({
|
||||
postcss: {
|
||||
plugins: [
|
||||
postcsspxtoviewport({
|
||||
unitToConvert: 'px', // 要转化的单位
|
||||
viewportWidth: 750, // UI设计稿的宽度
|
||||
unitPrecision: 6, // 转换后的精度,即小数点位数
|
||||
propList: ['*'], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
|
||||
viewportUnit: 'vw', // 指定需要转换成的视窗单位,默认vw
|
||||
fontViewportUnit: 'vw', // 指定字体需要转换成的视窗单位,默认vw
|
||||
selectorBlackList: ['el-'], // 指定不转换为视窗单位的类名,例如van-(vantUI组件),
|
||||
minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
|
||||
mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
|
||||
replace: true, // 是否转换后直接更换属性值
|
||||
exclude: [/node_modules/, /^(?!.*\/pages\/mobile\/).*$/], // 排除node_modules和非pages/m目录下的文件
|
||||
landscape: false, // 是否处理横屏情况
|
||||
// 只转换pages下的m文件
|
||||
include: [/pages\/mobile/],
|
||||
unitToConvert: 'px',
|
||||
viewportWidth: 750,
|
||||
unitPrecision: 6,
|
||||
propList: ['*'],
|
||||
viewportUnit: 'vw',
|
||||
fontViewportUnit: 'vw',
|
||||
selectorBlackList: ['el-'],
|
||||
minPixelValue: 1,
|
||||
mediaQuery: true,
|
||||
replace: true,
|
||||
// 严格只允许 pages/mobile 下的文件被转换
|
||||
// 使用强排除:排除 node_modules 和 所有不在 pages/mobile 下的文件
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
/^(?!.*\/(pages|src)\/mobile\/).*$/
|
||||
],
|
||||
landscape: false,
|
||||
// 可选:进一步放宽 include,以便某些移动端专用布局文件也参与
|
||||
include: [/\/pages\/mobile\//],
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user