element el-table的show-header 当表格列固定了切换显示表头没有出现

uklbhaso  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(102)

问题截图

https://files.gitter.im/57d2b9ee40f3a6eec0646156/fSdz/image.png

预览效果

代码:

<el-switch v-model="a"></el-switch>

 <el-table
 :data="tableData"
:show-header="a" 
style="width: 100%">
<el-table-column 
  fixed
  prop="date"
  label="日期"
  width="150">
</el-table-column>
<el-table-column
  prop="name"
  label="姓名"
  width="120">
</el-table-column>
<el-table-column
  <template slot-scope="scope">
    <el-button type="text" size="small">编辑</el-button>
  </template>
</el-table-column>
</el-table>
var Main = {
    data() {
      return {
        a: false, // 切换 thead显隐
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '2016-05-04',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1517 弄',
          zip: 200333
        }]
      }
    }
  }
hkmswyz6

hkmswyz61#

你可以试试在 a 改变时重新渲染整个表格;

6jygbczu

6jygbczu2#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题