Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
Created February 6, 2021 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diaolizhi/e7308c42895651009dc83e7f7b4fff72 to your computer and use it in GitHub Desktop.
Save diaolizhi/e7308c42895651009dc83e7f7b4fff72 to your computer and use it in GitHub Desktop.
jsx element ui image javascript
{
type: 'common', label: '反馈图片', formatter: (row) => {
if (!row.images) {
return <div style='color: #999;'>未上传图片</div>
}
const res = []
for (let i = 0; i < row.images.length; i++) {
const imageList = row.images.slice(i, row.images.length).concat(row.images.slice(0, i))
res.push(<el-image style='width: 220px; display: inline-block; margin-bottom: 10px; margin-right: 10px' src={row.images[i]}
preview-src-list={imageList}
object-fit='fill'/>)
}
return (
<div style='width: 700px;'>
{ res }
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment