首页 > 技术文章 > vue移动端适配

sjruxe 2021-07-31 19:00 原文

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>

推荐阅读