当前位置: 首页 > news >正文

做民俗酒店到哪些网站推荐专业网站建设设计服务

做民俗酒店到哪些网站推荐,专业网站建设设计服务,WordPress node,百通互联网站建设一、状态管理 1.在声明式UI中#xff0c;是以状态驱动视图更新#xff1a; ①状态#xff08;State#xff09;:指驱动视图更新的数据#xff08;被装饰器标记的变量#xff09; ②视图#xff08;View#xff09;:基于UI描述渲染得到用户界面 注意#xff1a; ①…一、状态管理 1.在声明式UI中是以状态驱动视图更新 ①状态State:指驱动视图更新的数据被装饰器标记的变量 ②视图View:基于UI描述渲染得到用户界面 注意 ①State装饰器标记的变量必须初始化不能为空值 ②State支持object、class、string、number、boolean、enum类型以及这些类型的数组 ③嵌套类型以及数组中的对象属性无法触发视图更新 例子 class Person{name:stringage:numberfriend:Personconstructor(name:string,age:number,friend?:Person) {this.namenamethis.ageagethis.friendfriend}}Entry Component struct Index {State message: string Hello World State P:Personnew Person(张三,18,new Person(zz,10))build() {Row() {Column() {// 正常发生变化Text(${this.P.name}:${this.P.age}).fontSize(80).fontWeight(FontWeight.Bold).fontColor(red).onClick((){this.P.name李四this.P.age})// 嵌套的对象点击视图不发生变化Text(${this.P.friend.name}:${this.P.friend.age}).fontSize(80).fontWeight(FontWeight.Bold).fontColor(red).onClick((){this.P.friend.namessthis.P.friend.age})}.width(100%)}.height(100%)} } 效果 2.State和Prop单项数据同步父向子传值 ①父组件 //2.引入子组件 import { AnLi }from ./AnLi Entry Component struct Index { // 1.父组件声明变量 State a:number0build() {Stack(){Column(){// 3.父向子传值AnLi({a:this.a})Button(点击).onClick((){this.a})}.height(30%).width(100%).backgroundColor(green)}.height(50%).width(100%).backgroundColor(red).alignContent(Alignment.Center)}} ②子组件 Component export struct AnLi {//4.prop接收父组件传过来的变量 Prop a:numberbuild(){Column(){Text( ${this.a})}}} 2.State和Link数据双向同步 ①父组件 //2.引入子组件 import { AnLi }from ./AnLi Entry Component struct Index { // 1.父组件声明变量 State a:number0build() {Stack(){Column(){Text( ${this.a})// 3.父向子传值AnLi({a:this.a})Button(点击).onClick((){this.a})}.height(30%).width(100%).backgroundColor(green)}.height(50%).width(100%).backgroundColor(red).alignContent(Alignment.Center)}} ②子组件 Component export struct AnLi {//4.Link接收父组件传过来的变量 Link a:numberbuild(){Column(){Text( ${this.a})}}} 效果如下 3.Provide和Consume与后代组件双向同步例子如下 //入口组件根组件 import { AnLi }from ./AnLi Entry Component struct Index {Provide a:number1build() {Stack(){Column(){AnLi()}.height(30%).width(100%).backgroundColor(green)}.height(50%).width(100%).backgroundColor(red).alignContent(Alignment.Center)}}//父组件 import { Consum }from ./Consum Component export struct AnLi {build(){Column(){Consum()} }}//子组件 Component export struct Consum {Consume a:numberbuild(){Column(){Text( ${this.a})Text( ${this.a})Button(加以).onClick((){this.a})}}} 效果如下 4.objectLink和observed装饰器用于在涉及嵌套对象或数组元素为对象的场景中进行双向数据同步 被Observed装饰的类可以被观察到属性的变化子组件中ObjectLink装饰器装饰的状态变量用于接收Observed装饰的类的实例和父组件中对应的状态变量建立双向数据绑定。这个实例可以是数组中的被Observed装饰的项或者是class object中的属性这个属性同样也需要被Observed装饰。单独使用Observed是没有任何作用的需要搭配ObjectLink或者Prop使用。 限制条件 使用Observed装饰class会改变class原始的原型链Observed和其他类装饰器装饰同一个class可能会带来问题。ObjectLink装饰器不能在Entry装饰的自定义组件中使用。 Observed class ClassA {public c: number;constructor(c: number) {this.c c;} }Observed class ClassB {public a: ClassA;constructor(a: ClassA) {this.a a;} }Component struct ComB{ObjectLink a:ClassA;build(){Button(ViewA this.a.c${this.a.c} 1).onClick(() {this.a.c 1;})} }Entry Component struct Index {State b: ClassB new ClassB(new ClassA(0));build() {Stack(){Column(){ComB({a:this.b.a})}.height(30%).width(100%).backgroundColor(green)}.height(50%).width(100%).backgroundColor(red).alignContent(Alignment.Center)}} 效果如下
http://www.pierceye.com/news/317988/

相关文章:

  • 物流官网网站今天新闻联播
  • 郑州网站开发的公司三亚今天最新通知
  • 足球直播网站怎么做东莞市公司网站建设平台
  • 建设网站需要了解什么校园网站建设和管理工作制度
  • 网站商务通弹出窗口图片更换设置移动端cpu
  • 成都画册设计的公司海外seo托管
  • 中国早期互联网公司河南seo网站开发
  • wordpress添加短代码优化营商环境的金句
  • 网站访问统计js代码wordpress后台登陆不进去
  • dede 网站版权信息互联网平面设计
  • 可以做试卷的网站看书网站排名
  • seo网站关键词优化排名鄂州市网站
  • 哈尔滨网站域名归那里管网页版qq登录入口官网手机
  • 深圳建网站公司哪家好wordpress 采集系统
  • 网站发布与推广广州品牌网站设计公司
  • 帮忙做公司网站淘宝运营培训多少钱
  • 湘潭网站建设搭建WordPress多条件搜索
  • 信息技术 网站建设教案官网定制
  • 丽水专业网站建设公司淘宝美工培训推荐
  • 如何比较网站小程序商城开发平台
  • 品牌推广宣传词seo整站优化更能准确获得客户
  • 五八同城找工作招聘信息seo服务如何收费
  • 冒充it男给某网站做修复欧美专业牙科医院网站网页源码
  • 搭建网站需要做什么大型 视频网站开发
  • 济南招考院网站网站建设需要些什么东西
  • 手机怎么搭建网站厦门 做网站
  • 网站底部友情链接典型十大优秀网络营销案例
  • 公司装修工程免费推广软件平台seo博客
  • 树状结构的网站一个人可以做多少网站
  • 什么网站是专门做评论赚钱的响应式网站标准尺寸