vue页面大小跟随屏幕尺寸自适应

mounted(){
	//自适应窗口
	if(window.screen.width > 1200){
		function bodyScale(){
			let deviceWidth = document.documentElement.clientWidth;
			let scale = deviceWidth / 1920;
			document.body.style.zoom = scale;
		}
		window.onload = window.onresize = function(){
			bodyScale();
		}
	}
}

你可能感兴趣的:(vue.js,javascript,前端)