Skip to main content
Unknown Salesforce 님이 #Experience Cloud에 질문했습니다

In a different case within the same LWC component, I need to display static content for the title and  need to display selecting content from the CMS.

For example in XML i have 2 property:

  <property

            name="title"

            type="String"

            label="type"

            placeholder="Enter title here.."

         

             />   

           <property

            name="content"

            type="contentReference"

            label="content"

             />

i need to display conditionally property based on requirement, how can i do for the same LWC component?

답변 1개
  1. 2023년 12월 16일 오후 6:20

    @Unknown Salesforce You can use conditional rendering in LWC but firstly you need to prepare your values by map those to object or JSON format if you have an xml. You could probably create a wrapper for that.

     

    Condition ref: https://developer.salesforce.com/docs/platform/lwc/guide/create-conditional.html

    Xml parsing to object: https://medium.com/@rawatswapnil911/xml-parsing-in-apex-f5f31828fc1e

0/9000