根据浏览器宽高度,动态显示内容的宽高,总体就是给设置宽高的对象设置一个监听器即可

<template>
  <el-container style="height: 100%;width: 100%;">
    ...
  </el-container>
</template>

<script>
  export default {
    data() {
      return {
             ...
        }
    },
    created() {
      // 创建监听和监听对象即可
      window.addEventListener('resize', this.setTableHeight)
      // this.setTableHeight()
    },
    destroy() {
      window.removeEventListener('resize', this.setTableHeight)
    },
    methods: {
      setTableHeight() {
        this.$nextTick(() => {
          this.statisticsTableHeight = (window.innerHeight - 100 - 36 * 2) / 2
          this.entityFrom.tableHeight = window.innerHeight-360 })
      }
    }
  }
</script>

<style scoped lang="scss">

</style>

 

Logo

前往低代码交流专区

更多推荐