export default {
name: 'App',
components: {
headerComponent
},
mounted() {
this.bodyScale();
// 监听页面的窗口的变化,每次窗口变化调用等比例缩放方法
window.addEventListener("resize", this.bodyScale, false);
},
methods: {
// 页面等比例缩放的方法
bodyScale() {
//获取当前分辨率下的可是区域宽度
var deviceWidth = document.documentElement.clientWidth;
// 分母——设计稿的尺寸
var scale = deviceWidth / 1920;
//放大缩小相应倍数
document.documentElement.style.zoom = scale;
}
}
}
04-14
6187
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-16
3292
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-28
1266
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-17
8064
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交