源码
//本质上就是改变html的基础字体
console.log("window.screen.width", window.screen.width);
let html = document.getElementsByTagName("html")[0];
console.log("html.style.fontSize", html.style.fontSize);
console.log(
"window.screen.width",
parseInt(window.screen.width),
parseInt(window.screen.width) / 10
);
console.log("html.style.fontSize", html.style.fontSize);
let app = document.getElementById("app");
console.log(
"window.screen.width",
parseInt(window.screen.width)
);
console.log("html.style.fontSize", parseInt(html.style.fontSize));
console.log("window.screen.width", window.screen.width);
console.log("app.scrollWidth", app.scrollWidth);
//这里通过app 标签宽度和屏幕宽度比例调整原有的font-size
html.style.fontSize =
(parseInt(html.style.fontSize) * window.screen.width) /
app.scrollWidth +
"px";
console.log("html.style.fontSize", html.style.fontSize);