Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
ZhangJianFrontEnd
Overview
Overview
Details
Activity
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
vue-project
ZhangJian
ZhangJianFrontEnd
Commits
46ab1237
Commit
46ab1237
authored
Jul 19, 2021
by
zsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新App.vue => 添加throttle
parent
13511f1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
App.vue
src/App.vue
+6
-2
No files found.
src/App.vue
View file @
46ab1237
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<
script
>
<
script
>
import
{
refreshScale
}
from
'runner/common/utils/refreshSize'
import
{
refreshScale
}
from
'runner/common/utils/refreshSize'
import
utils
from
'utils'
export
default
{
export
default
{
name
:
'app'
,
name
:
'app'
,
...
@@ -18,6 +19,9 @@ export default {
...
@@ -18,6 +19,9 @@ export default {
},
},
mounted
()
{
mounted
()
{
const
bodyStyle
=
document
.
body
.
style
bodyStyle
.
overflow
=
'auto'
// 如无需设置自动适配则注释该方法即可
// 如无需设置自动适配则注释该方法即可
this
.
initScale
()
this
.
initScale
()
},
},
...
@@ -32,9 +36,9 @@ export default {
...
@@ -32,9 +36,9 @@ export default {
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
// 窗口缩放时重新做适配
// 窗口缩放时重新做适配
window
.
addEventListener
(
'resize'
,
()
=>
{
window
.
addEventListener
(
'resize'
,
utils
.
throttle
(
()
=>
{
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
},
false
)
},
false
)
)
}
}
}
}
}
}
...
...
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