如图要想实现这个效果,首先这些图片是存储在一个数组中的,我们要取出图片然后遍历显示出来,可以如下显示:
render
: (
text)
=> {
if (
text &&
text.
length) {
const
imgs =
text.
map((
item,
index)
=>
<
div
key=
{
index
}
style=
{{
backgroundImage:
`url(
${
item.
mediaUrl
}
)` }
}
className=
'bg-cover teacher-medias'
/>
)
return
<
div
style=
{{
display:
'flex' }
}
>
{
imgs
}
</
div
>
}
}