我已经创建了一个新的组件,我希望能够通过aura:属性从静态资源和自定义标签传递图像。这是我试过的,但不起作用。如何使图像/文本显示?
<aura:attribute name="profileImage" type="string" default="Standard_Profile" />
<aura:attribute name="categoryName" type="string" default="Standard_Name" />
<img src="{!$Resource + !v.profileImage}" alt="profile pic"/>
<h3>{!$Label.'categoryName'}</h3>我对Salesforce非常陌生。
发布于 2021-06-19 15:24:02
将自定义标签和静态资源中的值映射为属性中的默认值,并在代码中使用。
<aura:component implements="flexipage:AvailableForAllPageTypes">
<aura:attribute name="profileImage" type="string" default="{!$Resource.profileImage}" />
<aura:attribute name="categoryName" type="string" default="{!$Label.c.categoryName}" />
<!-- Stand-alone static resources image file-->
<img src="{!v.profileImage}"/>
<!-- custom label -->
<div>
{!v.categoryName}
</div>
</aura:component>https://stackoverflow.com/questions/68037621
复制相似问题