橘猫敲代码 2023-12-15 16:25 采纳率: 66.9%
浏览 5
已结题

table内有数组,如何赋值


   <el-table border :data="dispatchList">
            <el-table-column label="承运人" prop="zoneName" :render-header="addRedStar">
              <template slot-scope="scope">
                <el-select v-model="scope.row.carrierId" clearable filterable
                  @change="carrierSelect(scope.row.carrierId,scope.$index)" style="width:100%">
                  <el-option v-for="item in carrierList" :key="item.carrierId" :value="item.carrierId"
                    :label="item.carrierName"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="基础分区" prop="zoneName" :render-header="addRedStar">
              <template slot-scope="scope">
                <el-select v-model="scope.row.dispatchZoneAndTypeList[scope.$index].zoneId" clearable filterable
                  style="width:100%">
                  <el-option v-for="item in BasePartition" :key="item.id" :value="item.id" :label="item.dispatchZoneName">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="DAS" prop="zoneName">
              <template slot-scope="scope">
                {{scope.row.dispatchZoneAndTypeList}}
                <el-select v-model="scope.row.dispatchZoneAndTypeList[scope.$index].zoneId" clearable filterable
                  style="width:100%">
                  <el-option v-for="item in DasPartition" :key="item.id" :value="item.id"
                    :label="item.dispatchZoneName">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="EAS" prop="zoneName">
              <template slot-scope="scope">
                <el-select v-model="scope.row.dispatchZoneAndTypeList[scope.$index].zoneId" clearable filterable
                  style="width:100%">
                  <el-option v-for="item in EasPartition" :key="item.id" :value="item.id"
                    :label="item.dispatchZoneName">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="RAS" prop="zoneName">
              <template slot-scope="scope">
                <el-select v-model="scope.row.dispatchZoneAndTypeList[scope.$index].zoneId" clearable filterable
                  style="width:100%">
                  <el-option v-for="item in RasPartition" :key="item.id" :value="item.id"
                    :label="item.dispatchZoneName">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" width="86">
              <template slot-scope="scope">
                <i class="iconfont icon-shanchuicon" @click="del_box(scope.$index)"></i>
              </template>
            </el-table-column>
          </el-table>

   dispatchList : [{
            carrierId: '',
            carrierName: '',
            dispatchZoneAndTypeList: [{
                dispatchZoneTypeId: '313',
                zoneId: '',
                zone: '',
              },
              {
                dispatchZoneTypeId: '314',
                zoneId: '',
                zone: '',
              },
              {
                dispatchZoneTypeId: '315',
                zoneId: '',
                zone: '',
              },
              {
                dispatchZoneTypeId: '316',
                zoneId: '',
                zone: '',
              }
            ]
          }],

这种数组里边有数组的格式,怎么给下拉框赋值,dispatchZoneAndTypeList传红框中每一个下拉框

img

  • 写回答

2条回答 默认 最新

  • 二九筒 2023-12-15 16:32
    关注

    用 v-for 循环该数组,然后把select标签放在v-for里面,然后取值赋值就行了

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月8日
  • 创建了问题 12月15日

悬赏问题

  • ¥15 单纯型python实现编译报错
  • ¥15 c++2013读写oracle
  • ¥15 c++ gmssl sm2验签demo
  • ¥15 关于模的完全剩余系(关键词-数学方法)
  • ¥15 有没有人懂这个博图程序怎么写,还要跟SFB连接,真的不会,求帮助
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音