houzhongjian
2025-05-29 3880399bef4144fa15264f470a0a51034c0253c9
1
2
3
4
5
6
7
8
9
// utils/rem.js
const baseWidth = 1920 // 设计稿基准宽度
const baseFontSize = 16 // 基准字体大小
 
export const setRem = () => {
  const scale = document.documentElement.clientWidth / baseWidth
  document.documentElement.style.fontSize =
    `${Math.min(scale, 1.5) * baseFontSize}px` // 限制最大缩放比例
}