- 安装插件:
UnoCSS
- 安装依赖:
"unocss": "^0.58.0",
"@unocss/preset-rem-to-px": "^0.58.0"
- 配置:
uno.config.ts
// uno.config.ts
import { defineConfig, presetAttributify, presetUno } from 'unocss'
import presetRemToPx from '@unocss/preset-rem-to-px'
export default defineConfig({
presets: [
presetUno(),
presetAttributify(),
presetRemToPx({
baseFontSize: 4 // 默认是4px => 1rem
})
]
})
愉快地使用
网友评论