세일즈포스 LWC 구성요소 input 값 가져오는 방법

이주영·2023년 10월 19일
0
  1. 두가지 작업을 해 줘야 한다. 우선, meta.xml에서 태그를 삽입.
    다음은 js에서 @api를 불러온다.

    [meta.xml]
    <targetConfigs>
        <targetConfig targets="lightning__AppPage">
            <supportedFormFactors>
                <supportedFormFactor type="Small" />
                <supportedFormFactor type="Large" />
    
            </supportedFormFactors>
        </targetConfig>
        <targetConfig targets="lightning__RecordPage">
            <supportedFormFactors>
                <supportedFormFactor type="Small" />
                <supportedFormFactor type="Large" />
            </supportedFormFactors>
            <property name="input_chart_customer" type="String" />
        </targetConfig>
    </targetConfigs>
    
    [js]
    @api input_chart_customer;
    
    
    
  2. 이렇게 하나의 구성요소에 input을 생성하였고, 이 구성요소를 각각 다른 값을 줘야 했다. js에서 어떻게 표현해야 할까

  • export default 아래엔 다른 소스를 가져오는 공간이여서 console 반영이 안됐다.
  • function이 이미 있을 때 function 안에서 console.log(this.매게변수)를 입력해주면 console창에서 확인이 가능하다.
profile
웹퍼블리셔 주영

0개의 댓글