大屏尺寸适配
mounted () {
this.reSize()
this.addEventOnResize(this.reSize)
},
methods: {
addEventOnResize(fn) {
const originFn = window.onresize
window.onresize = function () {
originFn && originFn()
fn()
}
},
reSize() {
const newScale = this.getScale()
this.scale = newScale
},
getScale() {
const x = window.innerWidth / 1920;
const y = window.innerHeight / 1080;
return { x, y };
}
}