news
This commit is contained in:
+2
-6
@@ -11,16 +11,12 @@ function setRem() {
|
||||
// 当前页面宽度相对于设计稿宽度的缩放比例
|
||||
const scale = document.documentElement.clientWidth / designWidth
|
||||
// 设置页面根节点字体大小(最高放大比例为maxScale)
|
||||
document.documentElement.style.fontSize =
|
||||
baseSize * Math.min(scale, maxScale) + 'px'
|
||||
document.documentElement.style.fontSize = baseSize * Math.min(scale, maxScale) + 'px'
|
||||
}
|
||||
|
||||
// 根据设计稿尺寸计算实际尺寸
|
||||
export function fontSize(res) {
|
||||
const clientWidth =
|
||||
window.innerWidth ||
|
||||
document.documentElement.clientWidth ||
|
||||
document.body.clientWidth
|
||||
const clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
||||
if (!clientWidth) return res
|
||||
const scale = clientWidth / designWidth
|
||||
return res * Math.min(scale, maxScale)
|
||||
|
||||
Reference in New Issue
Block a user