2025-09-16 【架构】自适应方案
postcss-px-to-viewport 和 postcss-pxtorem
postcss-px-to-viewport 和 postcss-pxtorem 是两个 postcss 插件,可以将 px 单位转换为 vw 或 rem 单位,以达到自适应的效果。
- 安装依赖:
1 | |
- 配置 vite.config.ts
1 | |
浏览器兼容
- 添加浏览器前缀:使用 Autoprefixer 插件为 CSS 添加必要的浏览器前缀,确保兼容性。
2025-09-16 【架构】自适应方案
https://zhangyingxuan.github.io/2025-09-16 【架构】自适应方案/