在 LWC 中显示附件

Display attachment in LWC

我正在尝试显示存储在附件中的图像。 我尝试了以下组合,但似乎没有任何效果:

<img src="'servlet/servlet.FileDownload?file='{productItem.product.attachmentId}"/>
<img src="/servlet/servlet.FileDownload?file={productItem.product.attachmentId}"/>
<img src=\{imageDownload}{productItem.product.attachmentId}/> <!--(imageDownload = '/servlet/servlet.FileDownload?file=';)-->
<img src="'https://ccdev3-abinbev-ei-crm.cs105.force.com/MyABIB2BCommunity/servlet/servlet.FileDownload?file='+{productItem.product.attachmentId}"/>
<img src="'https://ccdev3-abinbev-ei-crm.cs105.force.com/MyABIB2BCommunity/servlet/servlet.FileDownload?file='{productItem.product.attachmentId}"/>
<img src="https://ccdev3-abinbev-ei-crm.cs105.force.com/MyABIB2BCommunity/servlet/servlet.FileDownload?file={productItem.product.attachmentId}"/>```

Output:
https://i.stack.imgur.com/6q8kt.png

我已通过将包装器从 Id 更改为具有硬编码值的字符串来解决此问题: 基本上我的包装器现在看起来像 attachmentId: "https://ccdev3-abinbev-ei-crm.cs105.force.com/MyABIB2BCommunity/servlet/servlet.FileDownload?file=00P1w000003eSStEAM"

在 LWC HTML 中,我只是使用: