element的el-table表格自定义表头解决数据不更新问题

场景:

        需要生成一个表格,表头由后端返回,自定义生成。

问题:

        通过插槽传入表头,但是,如果我把表头初始值赋值为null,虽然可以正常显示表头,但是一开始会报错;如果我把表头初始值给列出来设计好的字段="",那么获取到后端返回的数据后,表头并不会自动更新!

      <el-table-column prop="name" width="200px">
        <template slot="header">
          <span>{{ tableTitle.name }}</span>
        </template>
      </el-table-column>

解决方法:

        element 官网上el-table上使用插槽 slot=“header”来实现自定义表头,在需要动态更新表头数据时,出现无法实时更新的情况,只需要将slot=“header” 改成#header ,效果就正常了。

      <el-table-column prop="name" width="200px">
        <template #header>
          <span>{{ tableTitle.name }}</span>
        </template>
      </el-table-column>

最近更新

  1. TCP协议是安全的吗?

    2024-04-14 19:10:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-14 19:10:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-14 19:10:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-14 19:10:03       20 阅读

热门阅读

  1. 【接着模拟赛】2024.4.14

    2024-04-14 19:10:03       17 阅读
  2. 239. 滑动窗口最大值

    2024-04-14 19:10:03       15 阅读
  3. win10清华源按装OPENCV和其他软件

    2024-04-14 19:10:03       16 阅读
  4. Csharp_pta2

    2024-04-14 19:10:03       15 阅读
  5. 中文域名有必要注册吗?

    2024-04-14 19:10:03       14 阅读
  6. conda搭建与管理python环境

    2024-04-14 19:10:03       15 阅读
  7. 为什么我们应该切换到Rust

    2024-04-14 19:10:03       13 阅读
  8. 源码安装 clr - hip runtime

    2024-04-14 19:10:03       12 阅读
  9. 【C++】vector的模拟实现

    2024-04-14 19:10:03       17 阅读
  10. AI技术创业有哪些机会?

    2024-04-14 19:10:03       15 阅读
  11. 安装IntelliJ IDEA插件教程

    2024-04-14 19:10:03       17 阅读