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
      },
相关推荐
万少1 小时前
用腻了 WorkBuddy 的默认界面?这个开源小工具给它换上了毛玻璃
前端·javascript·后端
To_OC3 小时前
LC 15 三数之和:双指针不难,难的是把去重做对
javascript·算法·leetcode
触底反弹4 小时前
🔥 前端也能玩转 AI 流式输出!从二进制流到打字机效果,一篇讲透
javascript·人工智能·node.js
胡萝卜术4 小时前
深度重构:Agent Skills——从 Prompt 工程到能力工程
javascript·架构·github
海上彼尚5 小时前
Nodejs也能写Agent - 16.LangGraph篇 - 条件分支与循环
前端·后端·langchain·node.js
To_OC6 小时前
从 “卡死半天” 到 “打字机效果”:大模型流式输出前端实现全记录
前端·javascript·llm
rockey6276 小时前
基于AScript的JavaScript脚本语言发布啦
javascript·c#·.net·js·script
SoaringHeart7 小时前
Flutter最佳实践:键盘辅助视图输入框天添加图片附件
前端·flutter
kyriewen7 小时前
我看完这篇安全论文——AI推荐的npm包,92%是编出来的
前端·javascript·ai编程
心中有国也有家8 小时前
AtomGit Flutter 鸿蒙客户端:Canvas 绘制进阶-路径、渐变与混合模式
android·javascript·flutter·华为·harmonyos