vue移动端适配

时间:2021-07-31 22:22:37   收藏:0   阅读:29
App.vue
<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  mounted() {
  
   //移动端适配
    var html = document.getElementsByTagName("html")[0];
    var owidth =
      document.body.clientWidth || document.documentElement.clientWidth;
      html.style.fontSize = (owidth / 375) * 12 + "px";
    
  },
};
</script>

<style >
#app {
 width: 100%;
 height: 100%;
 
}
</style>

原文:https://www.cnblogs.com/sjruxe/p/15084964.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!