Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RC_officialWebsite
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
RC_officialWebsite
Commits
90bc57a6
Commit
90bc57a6
authored
Nov 20, 2024
by
zxw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配修改
parent
c41d145c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
rem.js
src/utils/rem.js
+2
-6
No files found.
src/utils/rem.js
View file @
90bc57a6
...
...
@@ -3,14 +3,10 @@
const
baseSize
=
16
// 设置 rem 函数
function
setRem
()
{
// 当前页面屏幕分辨率相对于
的缩1920宽
放比例,可根据自己需要修改
// 当前页面屏幕分辨率相对于
1920宽的缩
放比例,可根据自己需要修改
const
scale
=
document
.
documentElement
.
clientWidth
/
1920
// 设置页面根节点字体大小(“Math.min(scale, 2)” 指最高放大比例为2,可根据实际业务需求调整)
// document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px'
// 设置页面根节点字体大小, 字体大小最小为12
const
fontSize
=
(
baseSize
*
Math
.
min
(
scale
,
2
))
>
16
?
(
baseSize
*
Math
.
min
(
scale
,
2
))
:
16
document
.
documentElement
.
style
.
fontSize
=
fontSize
+
'px'
document
.
documentElement
.
style
.
fontSize
=
baseSize
*
Math
.
min
(
scale
,
2
)
+
'px'
}
// 初始化
setRem
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment