ElementUI使用表格如何显示图片?

3131975015
  • 411

下面这样写图片显示不出来

<el-table
  :data="tableData"
  style="width: 100%"
>
  <el-table-column
    prop="address"
    label="标题"
    sortable
    width="180">
  </el-table-column>
  
  <el-table-column
    prop="img"
    label="封面"
    sortable
    width="180">
    <!--插入图片链接的代码-->
    <template slot-scope="scope">
      <img  :src="scope.row.image" alt="" style="width: 100px;height: 100px">
    </template>
  </el-table-column>
 
  <el-table-column
    prop="name"
    label="发布人"
    sortable
    width="180">
  </el-table-column>
  <el-table-column
    prop="date"
    label="发布时间"
    sortable
    width="180">
  </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>
tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄',
          img: 'https://www.xmb98.com/img/index_img/twos.png'
        }, 
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄',
          img: 'https://www.xmb98.com/img/index_img/twos.png'
        }, 
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄',
          img: 'https://www.xmb98.com/img/index_img/twos.png'
        }, 
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄',
          img: 'https://www.xmb98.com/img/index_img/twos.png'
        }]
回复
阅读 7k
1 个回答
<template slot-scope="scope">
  <img  :src="scope.row.image" alt="" style="width: 100px;height: 100px">
</template>

scope.row.image 改为 scope.row.img

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏