12345678910111213141516171819202122 |
- import { isPc } from "@queenjs/utils";
- export function initRemSize() {
- function setRem() {
- const clientWidth = document.documentElement.clientWidth;
- const width = clientWidth > 750 ? 750 : clientWidth;
- const fontSize = (width / 750) * (isPc() ? 50 : 100);
- document.documentElement.style.fontSize = fontSize + "px";
- // if (!isPc()) {
- // const meta = document.querySelector(
- // "meta[name=viewport]"
- // ) as HTMLMetaElement;
- // if (meta) {
- // meta.content = `width=375,initial-scale=${window.outerWidth / 375}`;
- // }
- // }
- }
- window.addEventListener("resize", setRem);
- setRem();
- }
|