21 lines
615 B
JavaScript
21 lines
615 B
JavaScript
/*
|
|
* @Description:
|
|
* @Version: 1.0.0
|
|
* @Author: fujingwen
|
|
* @Date: 2023-02-17 10:10:24
|
|
* @FilePath: /RuoYi-Cloud-Vue3/src/rem.js
|
|
*/
|
|
;(function (doc, win) {
|
|
const docEl = doc.documentElement
|
|
const resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
|
|
const recalc = function () {
|
|
const clientWidth = docEl.clientWidth
|
|
if (!clientWidth) return
|
|
docEl.style.fontSize = clientWidth / 19.2 + 'px'
|
|
}
|
|
if (!doc.addEventListener) return
|
|
recalc()
|
|
win.addEventListener(resizeEvt, recalc, false)
|
|
doc.addEventListener('DOMContentLoaded', recalc, false)
|
|
})(document, window)
|