vue+element-ui之表格中如何插入图片链接

本文详细介绍了如何使用 Element UI 的表格组件展示数据,并通过示例代码展示了如何配置列属性,包括 ID、图片描述、是否可用状态显示、图片预览及编辑和删除操作按钮。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 首先看下要实现的效果图:

    

  2. 相关的代码(红色部分)

<el-table
  :data="banner"
  style="width: 100%"
>
  <el-table-column
    prop="id"
    label="ID"
    sortable
    width="180">
  </el-table-column>
  <el-table-column
    prop="imgDiscrete"
    label="图片描述"
    sortable
    width="180">
  </el-table-column>

  <el-table-column
    prop="isEnable"
    label="是否可用"
    sortable
    width="180">

      <template slot-scope="scope">
        <span v-if="scope.row.isEnable==0">不可用</span>
        <span v-if="scope.row.isEnable==1">可用</span>
      </template>

  </el-table-column>
  <el-table-column
    prop="imgPath"
    label="图片路径"
    sortable
    width="180">
 
    <!--插入图片链接的代码-->
    <template slot-scope="scope">
      <img  :src="scope.row.imgPath" alt="" style="width: 50px;height: 50px">
    </template>

  </el-table-column>
  <el-table-column label="操作">
    <template slot-scope="scope">
      <el-button
        size="mini"
        type="success"
        @click.native.prevent="myedit(scope.$index,banner)">编辑</el-button>
      <el-button
        size="mini"
        type="success"
        @click.native.prevent="mydel(scope.$index,banner)">删除</el-button>
    </template>
  </el-table-column>
</el-table>

  

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值