wangfei
2024-11-26 5b78fff8128e6fedc42c368456d8ba6ebda5ed50
页面适配样式
2个文件已修改
20 ■■■■ 已修改文件
UI-Project/index.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/App.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/index.html
@@ -7,7 +7,7 @@
    <title>北玻</title>
  </head>
  <body>
    <div id="app"></div>
    <div id="app" style="width: 100vw;height: 100vh;"></div>
    <script type="module" src="/src/main.js"></script>
  </body>
</html>
UI-Project/src/App.vue
@@ -6,17 +6,17 @@
import DevicePixelRatio from '@/utils/evicePixelRatio.js';
// 定义一个函数来调整 body 的缩放比例
function bodyScale() {
  const deviceheight = document.documentElement.clientHeight;
  const scale = deviceheight / 740;
  document.body.style.zoom = scale;
}
// function bodyScale() {
//   const deviceheight = document.documentElement.clientHeight;
//   const scale = deviceheight / 740;
//   document.body.style.zoom = scale;
// }
// 在组件挂载时执行
onMounted(() => {
  new DevicePixelRatio().init();
  bodyScale();
});
// onMounted(() => {
//   new DevicePixelRatio().init();
//   bodyScale();
// });
</script>
<style scoped>
/* 你的样式内容 */