feature:代码初始化。
This commit is contained in:
20
src/rem.js
Normal file
20
src/rem.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* @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)
|
||||
Reference in New Issue
Block a user