el-table表格宽度自适应

第一步:

首先执行命令 
npm install af-table-column

第二步:

导入依赖:

import Vue from 'vue'
import ElementUI from 'element-ui'
import AFTableColumn from 'af-table-column'
Vue.use(AFTableColumn);

第三步:将标签<el-table-column>换成<af-table-column>即可。

<template>
      <el-table
        :data="tableData"
        height="100vh"
        border
        style="width: 170vh">
        <af-table-column
          prop="bzsj"
          label="编制时间"
          >
        </af-table-column>
        <af-table-column
          prop="jhbm"
          label="计划部门"
          >
        </af-table-column>
        <af-table-column
          prop="cgxm"
          label="采购项目">
        </af-table-column>
        <af-table-column
          prop="zynr"
          label="主要内容">
        </af-table-column>
      </el-table>
</template>

结果如图所示: