|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: wjc
|
|
|
* @Date: 2023-05-07 20:59:28
|
|
|
* @LastEditors: LiZhiWei
|
|
|
- * @LastEditTime: 2026-01-19 09:29:31
|
|
|
+ * @LastEditTime: 2026-01-19 15:56:48
|
|
|
* @Description:
|
|
|
*/
|
|
|
import {
|
|
|
@@ -30,25 +30,6 @@ export default defineConfig({
|
|
|
},
|
|
|
}),
|
|
|
],
|
|
|
- postprocess: (util) => {
|
|
|
- const pxRE = /(-?[\d.]+px)/g
|
|
|
- // 检查选择器是否包含移动端变体(lt-sm, lt-xs)
|
|
|
- const isMobile = util.selector.includes('lt-sm') || util.selector.includes('lt-xs')
|
|
|
-
|
|
|
- if (isMobile) {
|
|
|
- util.entries.forEach((i) => {
|
|
|
- const value = i[1]
|
|
|
- if (typeof value === 'string' && pxRE.test(value)) {
|
|
|
- // 移动端:按 750px 设计稿转换 (px / 7.5)
|
|
|
- i[1] = value.replace(pxRE, (match) => {
|
|
|
- const px = parseFloat(match)
|
|
|
- if (isNaN(px)) return match
|
|
|
- return `${(px / 7.5).toFixed(5)}vw`
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
transformers: [transformerDirectives(), transformerVariantGroup()],
|
|
|
postprocess: (util) => {
|
|
|
const pxRE = /(-?[\d.]+px)/g
|
|
|
@@ -71,19 +52,6 @@ export default defineConfig({
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- } else {
|
|
|
- // PC 端逻辑:如果你希望 PC 端也转换(按 1920),取消下面注释
|
|
|
- /*
|
|
|
- util.entries.forEach((i) => {
|
|
|
- const value = i[1]
|
|
|
- if (typeof value === 'string' && pxRE.test(value)) {
|
|
|
- i[1] = value.replace(pxRE, (match) => {
|
|
|
- const px = parseFloat(match)
|
|
|
- return `${(px / 19.2).toFixed(5)}vw`
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- */
|
|
|
}
|
|
|
},
|
|
|
rules: [
|