响应式缩放整个页面

596 阅读1分钟
function resize() {
    let ratioX = window.innerWidth / 6400;
    let tempH = 9 * window.innerWidth / 32;
    let ratioY = tempH / 1800;
    that.classContent = {
        transform: "scale(" + ratioX + "," + ratioY + ")",
        transformOrigin: "left top",
        backgroundSize: "100% 100%"
    }
}
window.onresize = function () {
    resize();
};
resize();
<template>
<div id="app" :style="classContent">
    <router-view />
</div>
</template>