feat: 接入大屏修复bug
This commit is contained in:
12
apps/web-antd/src/utils/flexible.ts
Normal file
12
apps/web-antd/src/utils/flexible.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
function setRootFontSize(): void {
|
||||
const baseWidth = 1920 // 设计稿宽度
|
||||
const baseFontSize = 16 // 设计稿根字体
|
||||
const screenWidth = window.innerWidth
|
||||
const fontSize = (screenWidth / baseWidth) * baseFontSize
|
||||
document.documentElement.style.fontSize = fontSize + 'px'
|
||||
}
|
||||
|
||||
setRootFontSize()
|
||||
window.addEventListener('resize', setRootFontSize)
|
||||
|
||||
export default setRootFontSize
|
Reference in New Issue
Block a user