このページへのアクセス
今日: 1 / 昨日: 0
総計: 2
文書の過去の版を表示しています。
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]; }); }
https://stenciljs.com/docs/properties
Prop Decorator(公式ドキュメント)
Props should be used to pass data down from the parent component to the child component.
親コンポーネント内のデータを、子コンポーネントに伝達するためには、親コンポーネント内でデータに@prop()というデコレータをつけて、エクスポートして、それを子コンポーネントで受けとるという作業が必要になります。
親コンポーネント
import { Prop } from '@stencil/core'; ... export class TodoList { @Prop() todoid: number; @Prop() title: string; @Prop() description: string; }
https://stenciljs.com/docs/state
State Decorator(公式ドキュメント)