diff --git a/ETSUI/ArkTSComponents/README.md b/ETSUI/ArkTSComponents/README.md index 4efb4747a13fac6970a4917912614a3554ad0b7f..db2ed4b82ba91bf2a4161b71425391be5af001ea 100644 --- a/ETSUI/ArkTSComponents/README.md +++ b/ETSUI/ArkTSComponents/README.md @@ -239,7 +239,7 @@ login() { ```typescript // ItemData.ets -export default class ItemData { + export default class PageResourcce { title: Resource; img?: Resource; others?: Resource; @@ -281,13 +281,13 @@ Tabs({ } ... .backgroundColor($r('app.color.mainPage_backgroundColor')) // “首页”的页面背景色 - .tabBar(this.baseTab(CommonConstants.HOME_TITLE, CommonConstants.HOME_TAB_INDEX, + .tabBar(this.TabBuilder(CommonConstants.HOME_TITLE, CommonConstants.HOME_TAB_INDEX, $r('app.media.home_selected'), $r('app.media.home_normal'))) ... } .backgroundColor(Color.White) // 底部tabBar栏背景色 .onChange((index: number) => { - this.index = index; + this.currentIndex = index; }) ... ``` @@ -306,8 +306,8 @@ Swiper(this.swiperController) { Image(img).borderRadius($r('app.float.home_swiper_borderRadius')) }, img => img.id) } -.autoPlay(true) ... +.autoPlay(true) ``` 然后使用Grid组件实现2\*4栅格图,代码如下 @@ -374,7 +374,7 @@ List() { this.settingCell(item) } .height($r('app.float.setting_list_height')) - }, JSON.stringify(item)) + }, item => JSON.stringify(item)) } ... .divider({ // 设置分隔线 @@ -384,7 +384,7 @@ List() { @Builder settingCell(item: ItemData) { Row() { - Row({ space: Constants.CommonConstants.COMMON_SPACE }) { + Row({ space: CommonConstants.COMMON_SPACE }) { Image(item.img) ... Text(item.title) diff --git a/ETSUI/OHLayoutAlign/README.md b/ETSUI/OHLayoutAlign/README.md index afc6913197efa3a7e52555be12085f771f186122..e2308c7c8cb05f08aee6667653ce66c9f3eba617 100644 --- a/ETSUI/OHLayoutAlign/README.md +++ b/ETSUI/OHLayoutAlign/README.md @@ -13,7 +13,7 @@ - **主轴**:在布局容器中,默认存在两根轴,分别是主轴和交叉轴,不同的容器中主轴的方向不一样的。 - 在Column容器中主轴的方向是垂直方向。 - 在Row容器中主轴的方向是水平方向。 - - 在Flex容器中可以通过direction参数设置主轴的方向,设置为Column时,主轴的方向是垂直方向。设置为Row时,主轴的方向是水平方向 + - 在Flex容器中可以通过direction参数设置主轴的方向,设置为Column时,主轴的方向是垂直方向。设置为Row时,主轴的方向是水平方向。 - 在Stack容器中没有明确主轴与交叉轴,通过设置alignContent参数来改变容器内组件的对齐方式。 - **交叉轴**:与主轴垂直相交的轴线,如果主轴是垂直方向,则交叉轴就是水平方向;如果主轴是水平方向,则交叉轴是垂直方向。 @@ -101,6 +101,7 @@ @Entry @Component struct LayoutAlignIndex { + private indexList: IndexListItem[] = getIndexList(); build() { Column() { // 标题 @@ -108,7 +109,7 @@ ... List() { - ForEach(INDEX_LIST, (item) => { + ForEach(this.indexList, (item) => { ListItem() { ListItemComp({ item: item }) .margin({ top: MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN })