Salesforce 如何使用设计属性从社区中的静态资源中给出图像路径

Salesforce 如何使用设计属性从社区中的静态资源中给出图像路径,salesforce,salesforce-lightning,salesforce-communities,Salesforce,Salesforce Lightning,Salesforce Communities,我试图使用社区中静态资源中的图像,使用设计属性,如 但它不工作。它显示为空白,好像路径不正确 <!-- Component --> <aura:component implements="forceCommunity:availableForAllPageTypes" access="global"> <aura:attribute name="showBannerImage" type="boolean" default="" access="globa

我试图使用社区中静态资源中的图像,使用设计属性,如

但它不工作。它显示为空白,好像路径不正确

<!-- Component -->
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
    <aura:attribute name="showBannerImage" type="boolean" default="" access="global"/>
    <aura:attribute name="bannerImage" type="String" default="" access="global" />
    <div class="container">
        <aura:if isTrue = "{!v.showBannerImage}">
            <aura:unescapedHtml value="{!v.bannerImage}"/>
        </aura:if>
    </div
</aura:component>


<!-- Design -->
<design:component>
    <design:attribute name="showBannerImage" label="Show Banner Image" />
    <design:attribute name="bannerImage" label="Banner Image" />
</design:component>


如果您已经在静态资源中上载了图像。 设置>静态资源,然后您可以像

当您试图使用
设计属性
访问图像时,您可以使用以下Lightning代码:

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
    <aura:attribute name="showBannerImage" type="boolean" default="" access="global"/>
    <aura:attribute name="bannerImage" type="String" default="" access="global" />
    <div class="container">
        <aura:if isTrue = "{!v.showBannerImage}">
            <img src="{!'/sfsites/c/resource/'+v.bannerImage}" style="width: 100%;" />
        </aura:if>
    </div
</aura:component>


我尝试了您提到的上述代码,它确实有效,但是如何在设计属性属性中使用整个
图像URL
,如
{!'/sfsites/c/resource/'+resource\u Name}
。我们可以在SFDC中这样使用,或者我们可以用不同的方式使用Property属性。还有一个问题-我如何在社区中使用文件上传属性,比如我们可以直接从本地系统上传图像并上传到资产中。
<design:component>
    <design:attribute name="showBannerImage" label="Show Banner Image" />
    <design:attribute name="bannerImage" label="Banner Image" />
</design:component>