当前位置:网站首页>map的使用(列表的数据赋值到表单,json逗号隔开显示赋值)

map的使用(列表的数据赋值到表单,json逗号隔开显示赋值)

2022-07-06 11:23:00 小菜鸟码住

 <el-table :data="zdlxList" border style="width: 100%" max-height="250">
        <el-table-column prop="zdlb" label="字段列表">
          <template #default="scope">
            <el-input v-model="scope.row.zdlb" type="textarea" placeholder="请输入字段列表" />
          </template>
        </el-table-column>
        <el-table-column prop="zdsm" label="字段说明">
          <template #default="scope">
            <el-input v-model="scope.row.zdsm" type="textarea" placeholder="请输入字段说明" />
          </template>
        </el-table-column>
        <el-table-column prop="zdlx" label="字段类型">
          <template #default="scope">
            <el-select v-model="scope.row.zdlx" :style="{ width: '100%' }" placeholder="请选择">
              <el-option
                v-for="item in zdlxTpye"
                :key="item.value"
                :label="item.label"
                :value="item.label"
              ></el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="100">
          <template #default="scope">
            <el-button link type="primary" size="small" @click.prevent="deleteRow(scope.$index)">
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>

js部分

 const aa = zdlxList.value.map(a => {
      return a.zdlx
    })
    const bb = zdlxList.value.map(a => {
      return a.zdlb
    })
    const cc = zdlxList.value.map(a => {
      return a.zdsm
    })
    data.form.fieldTypeList = aa.join(',')
    data.form.fieldList = bb.join(',')
    data.form.fieldDescList = cc.join(',')
原网站

版权声明
本文为[小菜鸟码住]所创,转载请带上原文链接,感谢
https://blog.csdn.net/hfyldx/article/details/125556142