1 Star 0 Fork 0

ScenarioSamples/CommonComponents

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

鸿蒙基础组件演示案例

介绍

本示例主要演示了一些常用基础组件的使用方法。

效果预览

图片名称

约束与限制

  1. 本示例仅支持标准系统上运行,支持设备:华为手机。
  2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。
  3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。
  4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。

使用说明

  1. 如果在运行该示例代码时,出现运行不了的情况,可尝试选择DevEco Studio菜单栏Build里面的Clean Project选项,来清理工程。

  2. 组件样式仅供参考,开发者可根据自身需求自定义组件样式,具体属性参数详见鸿蒙开发文档。

实现思路

通过List和ForEach加载每个组件名称,点击后跳转至组件演示页面,核心代码如下:


List() {
  ForEach(itemContent, (item: ItemContent, index?: number) => {
    ListItem() {
      Row() {
        Text(item.title)
          .padding(10)
          .margin({ left: 30 })
          .textOverflow({ overflow: TextOverflow.Ellipsis })
          .maxLines(1)
          .width('80%')
        Image($r('app.media.arrow_right')).size({ width: 25, height: 25 })
      }
      .justifyContent(FlexAlign.SpaceBetween)
        .height(40).width('100%')
    }
    .onClick(() => {
      router.pushUrl({ url: item.url })
    })
  })
}

工程目录

│  
├─basic
│  │  ButtonDemo.ets          // 按钮示例
│  │  ImageDemo.ets           // 图像示例
│  │  MenuDemo.ets            // 菜单栏示例
│  │  PasswordBoxDemo.ets     // 密码保险箱示例
│  │  PopupDemo.ets           // Popup示例
│  │  ProgressDemo.ets        // 进度条示例
│  │  RadioDemo.ets           // 单选框示例
│  │  RichEditorDemo.ets      // 富文本示例
│  │  StyledStringDemo.ets    // 样式字符串示例
│  │  SymbolGlyphDemo.ets     // 图标小符号示例
│  │  TextDemo.ets            // 文本示例
│  │  TextInputDemo.ets       // 文本输入框示例
│  │  ToggleDemo.ets          // 文本输入框示例
│  │  VideoDemo.ets           // 视频示例
│  │  XComponentDemo.ets      // XComponent示例
│  │  
│  └─passwordbox
│          LoginPage.ets      // 登录
│          RegisterPage.ets   // 注册
│          UpdatePassPage.ets // 更新密码
│          
├─common
│      CommonTitle.ets
│      
├─entryability
│      EntryAbility.ets
│      
├─entrybackupability
│      EntryBackupAbility.ets
│      
├─images
│      startIcon.png
│      
└─pages
        HomePage.ets         // 主页
        Index.ets

一份简单的问卷反馈

亲爱的Harmony Next开发者,您好!
为了协助您高效开发,提高鸿蒙场景化示例的质量,希望您在浏览或使用后抽空填写一份简单的问卷,我们将会收集您的宝贵意见进行优化

点击此处填写问卷

Empty file

About

【鸿蒙 Harmony Next 示例 代码】Demo中演示了一些常用基础组件的使用方法 expand collapse
Cancel

Releases

No release

Contributors (2)

All

Language(Optional)

Activities

can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/scenario-samples/common-components.git
git@gitee.com:scenario-samples/common-components.git
scenario-samples
common-components
CommonComponents
master

Search