el-table 表格循环多张图片

*爱你&永不变心* 提交于 2020-05-09 15:16:30
<el-table :data="weekList" stripe tooltip-effect="dark" class="table">
        <el-table-column
          v-for="(item, index) in tableOrderItem"
          :key="index"
          :width="item.width"
          :prop="item.prop"
          :label="item.label"
          align="center"
          show-overflow-tooltip
        >
        <template slot-scope="scope">
          <template v-if="item.prop === 'commodityDetails'">
            <div v-html="scope.row.commodityDetails"></div>
          </template>
          <!-- 图片有多张的情况 先分隔为数组 然后利用v-for 遍历得到 src  -->
          <template v-else-if="item.prop === 'picture1'">
            <div v-for="(item,index) in scope.row.picture1.split(',')" :key="index" class="table-flex">
              <el-image style="width: 50px; height: 50px; margin-right: 10px;" :src="imgUrl+item" :preview-src-list="[imgUrl+item]"></el-image>
            </div>
          </template>
          <template v-else>
            {{scope.row[item.prop]}}
          </template>
          </template>
        </el-table-column>
      </el-table>

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!