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
      },
相关推荐
烛阴19 分钟前
解锁 TypeScript 的元编程魔法:从 `extends` 到 `infer` 的条件类型之旅
前端·javascript·typescript
前端开发爱好者43 分钟前
弃用 ESLint + Prettier!快 35 倍的 AI 格式化神器!
前端·javascript·vue.js
wayhome在哪1 小时前
Cropper.js 轻松拿捏前端裁剪🤞
javascript·canvas·设计
&白帝&1 小时前
vue2和vue3的对比
javascript·vue.js·ecmascript
江东大都督周总1 小时前
rabbitmq集群
javascript·rabbitmq·ruby
vivi_and_qiao1 小时前
HTML的form表单
java·前端·html
一嘴一个橘子1 小时前
uniapp 顶部tab + 占满剩余高度的内容区域swiper
javascript·uni-app
wayhome在哪2 小时前
30KB 轻量王者!SortableJS 轻松搞定拖拽需求
javascript·设计·dom
骑驴看星星a2 小时前
Vue中的scoped属性
前端·javascript·vue.js
四月_h2 小时前
在 Vue 3 + TypeScript 项目中实现主题切换功能
前端·vue.js·typescript