iview/element的table高度动态设置

前言:

       在使用vue的框架的时候,其中列表是大家经常使用的功能,但是放到我们项目中的话,也有很多属性需要我们二次进行改动。

iview:

1、页面上:官方的话是推荐使用数字或者字符串,但我们需要的是动态,所以给他加一个动态值   :height="now_height"  

<Table
      ref="now_table"
      highlight-row
      :columns="columnsDt"
      :data="dataList"
      size="small"
      :height="now_height"
      :loading="loadingTable"
      border
    >

</Table>
 data() {
    return {
      now_height: null //table高度
    };
  },

 window.innerHeight  当前页面的高度,

 this.$refs.now_table.$el.offsetTop  拿到的是

 mounted() {
    this.now_height = window.innerHeight - this.$refs.now_table.$el.offsetTop - 43 - 100
  },

猜你喜欢

转载自blog.csdn.net/weixin_44727080/article/details/120065613