Lines Matching refs:Child
693 struct Child {
697 console.log(`Child message change from ${monitor.value()?.before} to ${monitor.value()?.now}`);
700 this.info.message = "Child aboutToAppear";
703 console.log("Child aboutToDisappear");
704 this.info.message = "Child aboutToDisappear";
708 Text("Child")
709 Button("change message in Child")
711 this.info.message = "Child click to change Message";
731 Button("show/hide Child")
740 Child({ info: this.info })
747 在上面的例子中,可以通过创建和销毁Child组件来观察定义在自定义组件中的\@Monitor的生效和失效时机。推荐按如下顺序进行操作:
751 …Child”,创建Child组件,在Child组件初始化\@Param装饰的变量以及\@Monitor之后,调用Child组件的aboutToAppear回调,改变message。此时Index组…
752 …Child”,改变message。此时Index组件与Child组件的\@Monitor均能监听到变化,日志输出`Index message change from Child aboutToAp…
753 …Child“,销毁Child组件,调用Child组件的aboutToDisappear回调,改变message。此时Index组件与Child组件的\@Monitor均能监听到变化,日志输出`Ch…
754 …essage in Index”,改变message。此时Child组件已销毁,其注册的\@Monitor监听也被解注册,仅有Index组件的\@Monitor能够监听到变化,日志输出`Index…
756 这表明Child组件中定义的\@Monitor监听随着Child组件的创建初始化生效,随着Child组件的销毁失效。
825 struct Child {
828 console.log("Child aboutToDisappear", this.infoWrapper.info?.age)
863 Child({ infoWrapper: new InfoWrapper(info) })
874 …change showFlag”切换if组件的条件时,Child组件会被销毁。此时,点击“change number”修改age的值时,可以通过日志观察到InfoWrapper中定义的\@Moni…
896 struct Child {
903 console.log("Child aboutToDisappear", this.infoWrapper.info?.age)
938 Child({ infoWrapper: new InfoWrapper(info) })
971 struct Child {
974 console.log("Child aboutToDisappear", this.infoWrapper.info?.age)
1010 Child({ infoWrapper: new InfoWrapper(info) })