Commit 46ab1237 by zsh

更新App.vue => 添加throttle

parent 13511f1c
......@@ -6,6 +6,7 @@
<script>
import { refreshScale } from 'runner/common/utils/refreshSize'
import utils from 'utils'
export default {
name: 'app',
......@@ -18,6 +19,9 @@ export default {
},
mounted () {
const bodyStyle = document.body.style
bodyStyle.overflow = 'auto'
// 如无需设置自动适配则注释该方法即可
this.initScale()
},
......@@ -32,9 +36,9 @@ export default {
refreshScale(this.designWidth, this.designHeight)
// 窗口缩放时重新做适配
window.addEventListener('resize', () => {
window.addEventListener('resize', utils.throttle(() => {
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