LoginSignup
0
0

Aura componentでの覚え

Last updated at Posted at 2021-02-08

まとめページに戻る
まとめページに戻る
まとめA~M

いつも思い出すのに苦労するので、ここに覚えを書いておきます。

system.debug(Logginglevel.INFO,'===== '+ up ); 

編集の初期化の書き方

List型の変数 List<String> myStrings = new List<String>{'a','b'}; 

Map型の変数 Map<String, String> MyStrings = new Map<String, String>{'a' => 'b', 'c' => 'd'.toUpperCase()};

コーディング

visualforceでは、document.execCommand('copy')で実行できるようです。

Aura コンポーネントでは以下にサンプルコードがありました。

https://salesforce.stackexchange.com/questions/221505/how-to-perform-copy-to-clipboard-in-lightning-component

その他

LWC コンポーネントの名前または aura:id がわからず、それが動的にレンダリングされる場合、事態はさらに複雑になります。ただし、LWC 内で使用されている構造またはクラスについて何か知っていれば、それを見つけることができる可能性があります。

LWC が合成シャドウを使用していることを考慮すると、「総当たり」方式で DOM を介してクエリを実行できますが、これは保守性の問題と潜在的なパフォーマンスへの影響のためお勧めできません。

概念的なアプローチは次のとおりです。

Aura コンポーネントの DOM 内の LWC ルートとなる可能性のあるすべての要素をクエリします。
これらの潜在的なルートを反復処理して、 shadowRootに飛び込み、目的の要素を見つけようとします。
JavaScript の例を次に示します。

var potentialLWCRoots = component.getElement().querySelectorAll('*');
var foundDiv = null;
for (var i = 0; i < potentialLWCRoots.length; i++) {
    var potentialDiv = potentialLWCRoots[i].shadowRoot && potentialLWCRoots[i].shadowRoot.querySelector(".my-lwc-class");

    if (potentialDiv) {
        foundDiv = potentialDiv;
        break;
    }
}

if (foundDiv) {
    console.log("Found the div!");
} else {
    console.log("Did not find the div.");
}

なぜかエラーが消えない

image.png

I have tried the way you mentioned already, but the error is persistant. Resolved the challenge in another Playground console for time being. Thanks for the responses! Cheers!

名前空間

同じようなことが質問されています。(解決してないですが...)

https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4Rq4SAF

VFpageとちがって、auraのコントローラにはつかないようなことが質問されています。
Lightning コードと書かれていますが、2016年当時なのでAuraのことだと思います。

https://salesforce.stackexchange.com/questions/150418/namespace-in-lightning-component

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0