动态改变表格宽度·

<div class="config-content" ref="discuntTable">

  <a-table
                  :style="{width:tableWidth+'px'}">
</a-table>

</div>

  created() {
    this.$refs = JSON.parse(JSON.stringify(this.$refs))
    this.$nextTick(() => {
      this.tableWidth = this.$refs['discuntTable'].offsetWidth - 48
    })
    window.addEventListener('resize', this.setTableWidth)
  },
  methods: {
    // 动态设置表格宽度
    setTableWidth() {
      let oWidth = document.querySelector('.fundcombConfig  .config-content').offsetWidth
      this.tableWidth=oWidth-48
    },
  }

 

posted @ 2019-12-03 17:03  smartwange  阅读(76)  评论(0)    收藏  举报