Iview 在Table組件中添加圖片

要先簡單瞭解render函數的使用。函數

直接上代碼:spa

        {
                        title: "商品圖片",
                        key: "commodityPhoto",
                        align: 'center',
                        render: (h, params) => {
                            return h('img', {
                                style: {//設置樣式
                                    width: '100px',
                                    'height': '80px',
                                    'border-radius': '5%'
                                },
                                attrs: {//設置屬性
                                    src: 'http://localhost:8888/' + params.row.commodityPhoto
                                }
                            });
                        }
         }

 

結果:code

相關文章
相關標籤/搜索