猿问

如何在材料表单元格中添加图像?

我在详细表中添加了图像(可能不正确)。现在我不会编辑数据并且图像字段有问题(没有图像一切正常)。 在此处输入图像描述

           columns={[{ title: 'ID', field: 'id' },

                     { title: '', field: 'img'},

                     { title: 'Title', field: 'title' },

                     { title: 'Price', field: 'price' },

                     { title: 'Quantity', field: 'quantity' },

                     { title: 'Subtotal', field: 'subtotal' },

                     { title: 'Description', field: 'description', hidden: true}, ]}

          data={rowData.items.map((item)=>

                  ({id: item.id, title:item.title, 

                    price:item.price,

                    quantity:item.quantity,

                    subtotal:item.price*item.quantity, 

                    description:item.description,

                    img:<img src={item.img} alt="" border="3" height="100" width="100" />

                                                 }))}


        editable={{

                  onRowDelete: oldData =>

                       new Promise((resolve, reject) => {

                           console.log(oldData);   

                           setTimeout(() => {

                               const index = oldData.tableData.id;

                               rowData.items.splice(index, 1);                                                          

                               removeItemFromOrder(rowData.orderNumber,oldData);

                               resolve()

                                                         }, 1000)

                                                     }),

                                             }}


蛊毒传说
浏览 106回答 1
1回答

Smart猫小萌

尝试这个:&nbsp;columns={[{ title: 'ID', field: 'id' },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: '', field: 'img', render: item => <img src={item.img} alt="" border="3" height="100" width="100" />},&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: 'Title', field: 'title' },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: 'Price', field: 'price' },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: 'Quantity', field: 'quantity' },&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: 'Subtotal', field: 'subtotal', render: (item) => item.price*item.quantity},&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ title: 'Description', field: 'description', hidden: true}, ]}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data={rowData.items}
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答