vue中如何在template中插入js生成的代码(使用了el-table)并渲染

vue 中如何在 template 中插入 js 生成的代码 (使用了 el-table) 并渲染#

实现 el-tabel 动态表头#

  • 目标为了实现 el-tabel 动态表头
  • 使用 js 递归生成了 el-table-column 代码,拼接成字符串,并且使用了当前组件中的 data 数组
  • 要如何才能把生成的字符串插入到 template 中的 <el-table></el-table > 中并渲染数据
  • 尝试使用 dom 获取 table id 并 append,但是代码并不像原生 html 一样渲染,使用 slot 插槽也不生效
  • 求大佬指点