吉安感知网项目-前端
chenyao
2026-02-07 b0daa0c145ff5455de8aacf5a892e84b6d88b462
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export function onResize() {
    const resize = () => {
        const scale = document.documentElement.clientWidth / 192
        document.documentElement.style.fontSize = scale + 'px'
    }
    resize()
    window.addEventListener('resize', resize)
}
 
export const pxToRem = width => {
    return width * 0.1 + 'rem'
}
 
 
// 不带单位的px转rem
export const pxToRemNum = width => {
    const scale = document.documentElement.clientWidth / 192
    return width * 0.1 * scale
}