0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LWC_@wireについて

Posted at
**XX.js**
accName;


//wireを使て、Apexのメソッドを呼び出しして、取引先一覧を取得する
//下記の二つの記述は、どっちが正しいかあるいは両方正しいか?

//⓵
@wire(getAccounts,{accountName:this.accName})
accounts;

//⓶
@wire(getAccounts,{accountName:'$accName'})
accounts;

結論として、
⓵の記述は画面を初期化する際、エラーが表示される
⓶の記述は正しいです。

説明:
1.@wireデコレータは、画面を初期化する際のみ自動的に実行されます。
2.@wireデコレータ利用する場合,AdapterConfigとして指定したaccNameは、'$accName'のように記述することで、accNameが変わった際、変更自動的に検知して、データを再取得します。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?