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
d7636299
Commit
d7636299
authored
Jul 16, 2021
by
zsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改缩放设置
parent
e2b51a1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
runner
runner
+1
-1
App.vue
src/App.vue
+16
-4
No files found.
runner
@
915d1233
Subproject commit
d23c1ed387a5099f276d4b2da2fbed7f4e005715
Subproject commit
915d12331a8812ea20cfa24531d9245dfa8d8179
src/App.vue
View file @
d7636299
...
@@ -11,18 +11,30 @@ export default {
...
@@ -11,18 +11,30 @@ export default {
name
:
'app'
,
name
:
'app'
,
data
()
{
data
()
{
return
{}
return
{
designWidth
:
3840
,
// 设计稿宽度
designHeight
:
2160
// 设计稿高度
}
},
},
mounted
()
{
mounted
()
{
// 如无需设置自动适配则注释该方法即可
this
.
initScale
()
this
.
initScale
()
},
},
methods
:
{
methods
:
{
/**
* @method initScale 设置页面缩放事件
*/
initScale
()
{
initScale
()
{
refreshScale
()
const
appStyle
=
document
.
getElementById
(
'app'
).
style
appStyle
.
position
=
'fixed'
window
.
addEventListener
(
'resize'
,
refreshScale
)
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
// 窗口缩放时重新做适配
window
.
addEventListener
(
'resize'
,
()
=>
{
refreshScale
(
this
.
designWidth
,
this
.
designHeight
)
},
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