App.vue 620 B

123456789101112131415161718192021222324252627282930
  1. <script setup lang="ts">
  2. import { onMounted } from 'vue';
  3. // import { Demo } from './utils/card/Demo.js';
  4. // const demoMain = () => {
  5. // Demo.find().start();
  6. // }
  7. // demoMain();
  8. const setFontSize = () => {
  9. // 字体大小动态调整
  10. const width = document.body.clientWidth;
  11. const fontSize = width / 137;
  12. const html = document.getElementsByTagName('html')[0];
  13. html.style.fontSize = fontSize + 'px';
  14. };
  15. onMounted(() => {
  16. setFontSize();
  17. window.onresize = () => {
  18. setFontSize();
  19. };
  20. });
  21. </script>
  22. <template>
  23. <router-view></router-view>
  24. </template>
  25. <style scoped></style>