17 lines
699 B
JavaScript
17 lines
699 B
JavaScript
import debounce from 'lodash/debounce'
|
|
export const setDomFontSize = () => {
|
|
let width = document.body.clientWidth
|
|
let fonSize =(width <= 1920? 1920 : width) / 100 +'px'
|
|
document.getElementsByTagName('html')[0].style['font-size'] = fonSize
|
|
// document.getElementsByTagName('body')[0].style.zoom = 1.5 / window.devicePixelRatio
|
|
|
|
//document.getElementsByTagName('body')[0].style.zoom = 1.25 / window.devicePixelRatio
|
|
// document.getElementsByTagName('body')[0].style.zoom = 1 / window.devicePixelRatio
|
|
|
|
|
|
|
|
}
|
|
//防抖
|
|
|
|
const setDomFontSizeDebounce = debounce(setDomFontSize,500)
|
|
window.addEventListener('resize',setDomFontSizeDebounce) |