Vue/Element-ui dynamically adjusts the height of the left menu bar

Dynamically adjust the height of the left menu bar to full body height, for reference only

<el-container :style="containerHeight">
      <el-scrollbar>
            <el-aside style="width:200px;">
                ....
            </el-aside>
      </el-scrollbar>
</el-container>

 

export default {
  data() {
    return {
      containerHeight: {
        height: ""
      }
    };
  },
  created() {
    //动态调整左侧菜单栏高度
    var docHeight = document.documentElement.clientHeight;
    this.containerHeight.height = docHeight - 20 + "px";
  }
};

 

Guess you like

Origin blog.csdn.net/SmartJunTao/article/details/108216851