首页 > 其他 > 详细

如何在 ant 的table中实现图片的渲染

时间:2020-02-07 12:30:09      阅读:118      评论:0      收藏:0      [点我收藏+]
<a-table rowKey="id"
         :dataSource="bookDataSource"
         :columns="columns"
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,columnTitle: columnTitle}"
         :pagination="false">

  <template slot="operation"
            slot-scope="text, record">
    <a-popconfirm v-if="bookDataSource.length"
                  title="确定删除该记录吗?"
                  @confirm="() => onDelete(record.id)">
      <a href="javascript:;">移除</a>
    </a-popconfirm>
  </template>
</a-table>
data () {
    return {
      columnTitle: '是否必选',
      selectedRowKeys: [],
      bookDataSource: [],
      columns: [
        {
          title: '商品名称',
          width: '30%',
          align: "center",
          dataIndex: 'bookName',
        },
        {
          title: '商品图片',
          align: "center",
          width: '30%',
          dataIndex: 'bookImg',
          customRender: (text, row, index) => {
            return <img src={text} style={{ width: '50px', height: '50px', borderRadius: '1–0%' }}></img>;
          }
        },
        {
          title: '价格',
          align: "center",
          width: '15%',
          dataIndex: 'listPrice',
        },
        {
          title: '操作',
          dataIndex: 'operation',
          align: "center",
          width: '12%',
          scopedSlots: { customRender: 'operation' },
        }],
}

在columns中进行进一步处理

如何在 ant 的table中实现图片的渲染

原文:https://www.cnblogs.com/eternityz/p/12271906.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!