Commit 46ab1237 by zsh

更新App.vue => 添加throttle

parent 13511f1c
...@@ -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))
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment