
export default {
  data(){
    return{
      // 默认最大高度
      scrollY: 200,   //高度
      tableHeight: document.body.clientHeight,
      showSearch:true,
    }
  },

  mounted() {
    // console.log(this.searchH)
    window.onresize = () => {
      return (() => {
        this.scrollY=this.getTableScroll()
      })()
    };
    this.scrollY=this.getTableScroll()
  },
  watch: {
    tableHeight (val) {
      console.log("实时屏幕高度：",val, this.scrollY );
    },
    toggleFormTag(val){
      this.$nextTick(() => {
        this.scrollY=this.getTableScroll()
      })
    },
    isShow(val){
      this.$nextTick(() => {
        this.scrollY=this.getTableScroll()
      })
    }
    
  },
  methods:{
    getTableScroll( extraHeight=this.extraHeight, id) {
      if (typeof extraHeight == "undefined") {
        //  默认底部分页60 + 边距18
        extraHeight = 118
      }
      let tHeader = null
      if (id) {
        tHeader = document.getElementById(id)?.getElementsByClassName("ant-table-thead")?.[0] || null
      } else {
        tHeader = document.getElementsByClassName("ant-table-thead")[0]
      }
      //表格内容距离顶部的距离
      let tHeaderBottom = 0
      if (tHeader) {
        tHeaderBottom = tHeader.getBoundingClientRect().bottom
      }

      let height = document.body.clientHeight - (tHeaderBottom + extraHeight)

      return height
    },

    changeShow(val){
      // console.log(val)
      this.$nextTick(() => {
        this.scrollY=this.getTableScroll()
      })
    },
  }
}

