iview table组件高度动态设置

版权声明:本文为QQ帝国原创博客,非经本人同意,且勿转载。。 https://blog.csdn.net/QQ_Empire/article/details/84973942

 一、组件

<Table highlight-row border :columns="columns7" :data="data6" ref="table" :height="tableHeight"></Table>

 二、data数据

tableHeight: 450,

三、mounted 钩子

mounted() {
    // 设置表格高度
    this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  },

window.innerHeight 是浏览器的可用高度

this.$refs.table.$el.offsetTop 是表格距离浏览器可用高度顶部的距离

猜你喜欢

转载自blog.csdn.net/QQ_Empire/article/details/84973942
今日推荐