1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Lightningコンポーネント(DOM操作)

Last updated at Posted at 2018-10-26

標準コンポーネントの組み合わせでは機能要件を満たせない場合は、DOMエレメントを直接操作する必要がある。

DOMエレメントの取得

<div aura:id="items" class="slds-listbox__option slds-listbox__option_plain slds-media slds-media_small slds-media_inline" data-attr="123" /> 

var item = cmp.find("item");
vat element = item.getElement();
var attr = element.getAttribute('data-attr')  //123を取得

Locker Serviceが有効になっていると各変数はProxyとなるため、Developer Consoleのようなデバッガー環境でも変数の属性を一覧表示することはできない。その場合はAPIのバージョンを39.0にするとLocker Serviceが外れるため、従来のように変数の属性を一覧表示できるようになる。

1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?