サルでもわかるWEBプログラミング

フリーソフトのみでホームページ作成

ユーザ用ツール

サイト用ツール


00.stencil:03.stencilの_propと_state


文書の過去の版を表示しています。


03.Stencilの@propと@state

Angularには、双方向データバインディングがあるのですが、Stencilには単方向データバインディングしかないです。

そのため、Stencilでは、フォームからの入力データを@state()で受け取り、何かに入れて、render()で表示するようにプログラミングする必要があります。

引用元:https://www.joshmorony.com/building-a-pwa-with-stencil-storage-and-services/

  componentDidLoad() {
    const router = document.querySelector("ion-router");
 
    // Refresh data every time view is entered
    router.addEventListener("ionRouteDidChange", async () => {
      const holdings = await Holdings.getHoldings();
      this.holdings = [...holdings];
    });
  }

@prop()の解説のリンク

https://stenciljs.com/docs/properties
Prop Decorator(公式ドキュメント)

@state()の解説のリンク

https://stenciljs.com/docs/state
State Decorator(公式ドキュメント)

リンク


00.stencil/03.stencilの_propと_state.1569384287.txt.gz · 最終更新: 2019/09/25 by adash333

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki