中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

聊城做網站的公司咨詢最常用的幾個關鍵詞

聊城做網站的公司咨詢,最常用的幾個關鍵詞,網站建設的風險管理,wordpress鏈接跳轉頁面狀態(tài) State: 在聲明式UI中,以狀態(tài)驅動視圖更新 狀態(tài)(State):指驅動視圖更新的數(shù)據(jù)(被裝飾器標記的變量)視圖(View):基于UI描述渲染得到的用戶界面 使用示例…

狀態(tài)?@State:

在聲明式UI中,以狀態(tài)驅動視圖更新

  1. 狀態(tài)(State):指驅動視圖更新的數(shù)據(jù)(被裝飾器標記的變量)
  2. 視圖(View):基于UI描述渲染得到的用戶界面

使用示例:

@Entry
@Component
struct Index {// 使用狀態(tài)裝飾器@State message: string = 'Hello Word'build() {Column(){Text(this.message)}};
}

說明:

  • @State裝飾器標記的變量初始化必須有值
  • @State支持Object、Class、string、number、boolean、enum類型以及這些類型的數(shù)組
  • 嵌套類型以及數(shù)組中的對象屬性無法觸發(fā)視圖更新(相當于淺層監(jiān)聽)

父子組件數(shù)據(jù)同步 @Prop和@Link:

對比:

@Prop@Link
同步類型單向同步雙向同步
允許裝飾的變量類型
  • @Prop只支持string、number、boolean、enum類型
  • 父組件對象類型,子組件hi對象類型
  • 不可以是數(shù)組,any
  • 父子類型一致:string、number、boolean、enum、object、class以及他們的數(shù)組
  • 數(shù)組中元素增、刪、替換會引起刷新
  • 嵌套類型以及數(shù)組中的對象屬性無法觸發(fā)視圖更新
初始化方式不允許子組件初始化父子間傳遞,不允許子組件初始化

@Prop使用示例:

PS:@Prop定義的數(shù)據(jù)在子組件不能初始化

@Entry
@Component
struct Index {@State msg: string = 'Hello Word'build() {Column() {MsgModule({msg:this.msg})Button('更改文案').onClick(()=>{this.msg = 'Hello arkTs'})}}
}@Component
struct MsgModule {@Prop msg:stringbuild(){Text(this.msg).fontSize(30).fontColor('red')}
}

@Link使用示例:

PS:

  • @Link定義的數(shù)據(jù)在子組件不能初始化
  • @Link定義的數(shù)據(jù),父組件在使用時候,去掉"this."且前邊加"$"符號
@Entry
@Component
struct Index {@State msg: string = 'Hello Word'build() {Column() {MsgModule({msg: $msg})}}
}@Component
struct MsgModule {@Link msg:stringbuild(){Row(){Text(this.msg).fontSize(30).fontColor('red')Button('更改文案').onClick(()=>{this.msg = 'Hello arkTs'})}}
}

?@Provide和@Consume:(跨組件提供雙向的數(shù)據(jù)同步)

??@Provide定義的數(shù)組,其他組件在使用時候直接使用@Consume定義使用,不需要在調用組件時候進行參數(shù)傳遞

使用示例:

@Entry
@Component
struct Index {@Provide msg: string = 'Hello Word'build() {Column() {MsgBtnModule()}}
}@Component
struct MsgBtnModule {build(){Row(){MsgModule()}}
}@Component
struct MsgModule {@Consume msg: stringbuild(){Row(){Text(this.msg).fontSize(30).fontColor('red')Button('更改文案').onClick(()=>{this.msg = 'Hello arkTs'})}}
}

@ObjectLink和@Observed:(涉及嵌套對象或數(shù)組元素為對象的場景中進行雙向數(shù)據(jù)同步)

使用示例:

@Observed
class ArrInt {name: string = ""price: number = 0
}@Entry
@Component
struct Index {@State num:number = 0@State arr: ArrInt[] = [{name: '華為 Meta 50',price: 7999},{name: '華為 Meta 60',price: 8999},{name: '華為 Meta 60 pro',price: 9999},]build() {Column() {Text('漲價' + this.num.toString() + '次').fontSize(50).margin(20)ArrModule({num: $num, arr: $arr})}}
}@Component
struct ArrModule {@Link num: number@Link arr: ArrInt[]build(){Row(){List({space: 10}){ForEach(this.arr,(item: ArrInt) => {ListItem(){ArrItemModule({item:item, num: $num})}})}}}
}@Component
struct ArrItemModule {@ObjectLink item: ArrInt@Link num: numberbuild(){Column(){Text(this.item.name).fontSize(30).fontColor('red')Text(this.item.price.toString()).fontSize(30).fontColor('#000')Button('漲價').onClick(()=>{this.num += 1})}}
}

http://www.risenshineclean.com/news/60747.html

相關文章:

  • 網站建設主管招聘浙江百度查關鍵詞排名
  • seo優(yōu)化銷售seo網上培訓課程
  • 邯鄲專業(yè)做網站報價建設網站公司
  • 1核2g 做網站百度手機應用商店
  • 做網站的小圖標360網站排名優(yōu)化
  • 昆明哪些做網站建設的公司網站惡意點擊軟件
  • 做水果網站行營銷推廣的形式包括
  • 亞馬遜網站推廣怎么做學網絡營銷有用嗎
  • 浙江做網站的公司百度公司招聘信息
  • 哪個網站做調查問卷賺錢長春seo招聘
  • 騰訊云注冊域名后怎么做網站剛剛突發(fā)1驚天大事
  • wex5網站開發(fā)北京seo助理
  • 南京電商網站建設公司百度搜索引擎的原理
  • 免費茶葉網站建設點擊器
  • 360免費做網站電腦零基礎培訓班
  • icp備案 網站服務內容蘇州網站制作開發(fā)公司
  • 上海網站建設方案托管銀川seo
  • 太原網站設計公司軟件開發(fā)定制
  • 鄭州網站建設國奧大廈網站seo資訊
  • 時時彩網站開發(fā)違法嗎升華網絡推廣軟件
  • 濮陽市建設分局網站百度賬號中心
  • qq郵箱登錄入口網頁版廣州seo網站推廣公司
  • 搭建cms網站網絡互聯(lián)網推廣
  • 廣東兩學一做網站西安網是科技發(fā)展有限公司
  • 江門模板建站哪家好網站推廣網絡營銷方案
  • 網站里的橫幅怎么做項目網站
  • 鄭州網站建設哪家好打開百度一下網頁版
  • 青之峰做網站廈門seo新站策劃
  • 臨清網站制作公司plc培訓機構哪家最好
  • 創(chuàng)建公司策劃書寧波優(yōu)化推廣選哪家