el-table 实现动态表头 静态内容 根据数据显示动态输入框

直接放代码了

css 复制代码
          <el-table
            :data="form.tableDataA"
            border
            stripe
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column
              v-for="(category, categoryIndex) in form.tableDataA"
              :key="categoryIndex"
              :label="category.name"
              width="420"
              align="center"
            >
              <el-table-column label="目标" width="160" align="center">
                <template slot-scope="scope">
                  <el-input
                    v-model="category.children[scope.$index].goal"
                    :maxlength="30"
                    show-word-limit
                  />
                </template>
              </el-table-column>
              <el-table-column label="预判" width="160" align="center">
                <template slot-scope="scope">
                  <el-input
                    v-model="category.children[scope.$index].prejudge"
                    :maxlength="30"
                    show-word-limit
                  />
                </template>
              </el-table-column>
              <el-table-column label="差距" width="160" align="center">
                <template slot-scope="scope">
                  <el-input
                    v-model="category.children[scope.$index].gap"
                    :maxlength="30"
                    show-word-limit
                  />
                </template>
              </el-table-column>
            </el-table-column>
          </el-table>

      form: {
        projectId: "", // 项目id
        time: "", // 日期
        producerId: "", // 制定人
        tableDataA: [
          {
            name: "销售额(万元)",
            children: [
              {
                goal: "222",
                prejudge: "",
                gap: "",
              },
            ],
          },
          {
            name: "销售回款(万元)",
            children: [
              {
                goal: "111",
                prejudge: "",
                gap: "",
              },
            ],
          },
          {
            name: "新增入住人数",
            children: [
              {
                goal: "333",
                prejudge: "",
                gap: "",
              },
            ],
          },
        ], // A
        tableDataB: [], // B
        tableDataC: [], // C
        tableDataD: [], // D
        tableDataE: [], // E
        tableDataF: [], // F
      },
相关推荐
键盘不能没有CV键1 小时前
【图片处理】✈️HTML转图片字体异常处理
前端·javascript·html
yantuguiguziPGJ2 小时前
WPF 联合 Web 开发调试流程梳理(基于 Microsoft.Web.WebView2)
前端·microsoft·wpf
大飞记Python2 小时前
部门管理|“编辑部门”功能实现(Django5零基础Web平台)
前端·数据库·python·django
tsumikistep3 小时前
【前端】前端运行环境的结构
前端
你的人类朋友3 小时前
【Node】认识multer库
前端·javascript·后端
Aitter3 小时前
PDF和Word文件转换为Markdown的技术实现
前端·ai编程
mapbar_front4 小时前
面试问题—上家公司的离职原因
前端·面试
昔人'5 小时前
css使用 :where() 来简化大型 CSS 选择器列表
前端·css
昔人'5 小时前
css `dorp-shadow`
前端·css
流***陌5 小时前
扭蛋机 Roll 福利房小程序前端功能设计:融合趣味互动与福利适配
前端·小程序