在 RuoYi 框架中使用 lib-flexible 和 postcss-pxtoremloaderOptions 来实现 rem 适配时,可以将 'treeselect' 目录排除在转换范围之外,以避免其样式被转换为 rem。

以下是排除 'treeselect' 目录的示例代码:

postcss: { 
  plugins: [ 
    autoprefixer(), 
    pxtorem({ 
      rootValue: 37.5,  // 手机设计稿宽度为 375px 的 
      propList: ['*'], // 属性的选择器,* 表示通用 
      exclude: /(web|node_modules|treeselect)/i, // 忽略 web、node_modules 和 treeselect 下的所有文件 
      selectorBlackList: ['.a-'] // 过滤掉 .a- 开头的 class,不进行 rem 转换 
    }), 
  ] 
} 

exclude 中加入 'treeselect' 的路径,即可将其排除在 rem 转换之外。


原文地址: https://www.cveoy.top/t/topic/oONY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录