静的リソース内の JavaScript ファイルを読み込むために、Lightning Web コンポーネントで完了する必要がある 3 つのアクションはどれですか? 3 つの答えを選択してください
正解:A,C,D
The three actions that must be completed in a Lightning web component for a JavaScript file in a static resource to be loaded are to import the static resource, call loadScript, and import a method from the platformResourceLoader. Importing the static resource allows the developer to reference the JavaScript file by name, and use the @salesforce/resourceUrl annotation to assign the URL of the file to a property. Calling loadScript allows the developer to load the JavaScript file dynamically, and use a callback function to handle the success or failure of the loading. Importing a method from the platformResourceLoader allows the developer to use the loadScript method, which is a utility method that is part of the platformResourceLoader module. Referencing the static resource in a <script> tag will not work, as the <script> tag is not supported in the Lightning web component template, and it will not load the JavaScript file. Appending the static resource to the DOM will not work, as it is not a valid way to load a JavaScript file in a Lightning web component, and it will not execute the code in the file. Reference: [Use Third-Party JavaScript Libraries], [Lightning Web Components Developer Guide]