aura:locationChange
URL のハッシュ部分が変更されると、このイベントが自動的に起動されます。
ハッシュ値の変更に対応するには、<aura:handler> 属性を使用します。このイベントを処理するには、コンポーネントに <aura:handler event="aura:locationChange"> タグを 1 つだけ指定します。
aura:locationChange イベントには、次の属性があります。
1<aura:handler event="aura:locationChange" action="{!c.update}"/>次のクライアント側のコントローラは、aura:locationChange イベントを処理します。この例では、ハンドラは update アクションに結び付けられています。
aura:locationChange ハンドラには、次の必須属性があります。
1({
2 update : function (component, event, helper) {
3 // Get the new hash from the event
4 var loc = event.getParam("token");
5 // Do something else
6 }
7})| 属性名 | 型 | 説明 |
|---|---|---|
| event | String | イベント名。aura:locationChange に設定する必要があります。 |
| action | Object | イベントを処理するクライアント側のコントローラアクション。 |
| 属性名 | 型 | 説明 |
|---|---|---|
| token | String | URL のハッシュ部分。 |
| querystring | Object | ハッシュのクエリ文字列部分。 |