From c92fc2fa8ef7ffcbffea1b3b7e8c63358ae1db25 Mon Sep 17 00:00:00 2001 From: 15527729852 <975850018@qq.com> Date: Mon, 24 Apr 2023 17:05:41 +0800 Subject: [PATCH] =?UTF-8?q?ArkTSComponents=E5=92=8COHLayoutAlign=20README.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ETSUI/ArkTSComponents/README.md | 12 ++++++------ ETSUI/OHLayoutAlign/README.md | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ETSUI/ArkTSComponents/README.md b/ETSUI/ArkTSComponents/README.md index 4efb4747..db2ed4b8 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 afc69131..e2308c7c 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 }) -- Gitee