vue自适应宽度

56 阅读1分钟
        模板:
        <div class="bottomBox" :style="{ height: bottomBoxheight + 'px' }">
          <router-view></router-view>
        </div>
        
        js:
   mounted() {
    this.bottomBoxheight = document.getElementById("leftmenu").offsetHeight - 120;
    window.addEventListener('resize',this.handleResize)
  },
   methods: {
    handleResize(){      
      this.bottomBoxheight = document.getElementById("leftmenu").offsetHeight - 120; 
    },