# ColorUI **Repository Path**: hihopeorg/ColorUI ## Basic Information - **Project Name**: ColorUI - **Description**: UI基础组件库 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-10-14 - **Last Updated**: 2024-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ColorUI组件库 #### 项目介绍 ColorUI是一款鲜亮的高饱和色彩,专注视觉的CSS组件库 #### 效果展示 ![动画](./动画.gif) ## 下载安装 ```shell npm install @ohos/colorui ``` OpenHarmony npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 。 #### 使用说明 ##### 元素 ###### Layout 布局 功能介绍:展示自定义布局 使用样例: ``` //layout.hml
{{$item.title}}
固定尺寸
xs(20%)
sm(40%)
sub(50%)
lg(60%)
xl(80%)
//layout.js export default { data: { CustomBar: globalData.CustomBar, TabCur: 0, tabNav: [ { title: 'Flex布局', selected: true, }, { title: 'Grid布局', selected: false, }, { title: '辅助布局', selected: false, } ], list2: Array(2).fill().map((_, index) => (index + 1)), list4: Array(4).fill().map((_, index) => (index + 1)), list5: Array(5).fill().map((_, index) => (index + 1)), list6: Array(6).fill().map((_, index) => (index + 1)), list8: Array(8).fill().map((_, index) => (index + 1)), list10: Array(10).fill().map((_, index) => (index + 1)), selectedTabIndex: 0, }, changeTabIndex(e) { for (let i = 0; i < this.tabNav.length; i++) { let element = this.tabNav[i]; element.selected = false; if (i === e.index) { element.selected = true; } } } } ``` ##### 组件 ###### Bar 操作条 功能介绍:展示自定义操作条 使用样例: ``` //bar.hml
输入操作条
``` ##### 扩展 ###### Indexes 索引列表 功能说明:展示自定义索引列表 使用样例: ``` //indexes.hml
{{list[$idx]}}
{{list[$idx]}}
//indexes.js export default { data: { StatusBar: 0, CustomBar: 0, hidden: true, listCur: '', list: [], list2: Array(2).fill().map((_, index) => (index + 1)), }, onInit() { for (let i = 0; i < 26; i++) { this.list[i] = String.fromCharCode(65 + i) } }, onReady() { }, //获取文字信息 getCur(e) { this.hidden = false; this.listCur = this.list[e.target.id]; }, //滑动选择Item tMove(e) { if (e.touches[0].localY > 0) { let index = parseInt(e.touches[0].localY / 20); this.listCur = this.list[index]; } console.log('tMove = ' + this.listCur); }, //触发全部开始选择 tStart() { this.hidden = false; }, //触发结束选择 tEnd() { this.hidden = true; let scrollToId = 'indexes-' + this.listCur; console.log('tEnd = ' + scrollToId); this.$element('scrollDiv').scrollTo({id: scrollToId, duration: 200, timingFunction: 'ease-in'}); } } ``` ##### 关于 ###### About 关于ColorUI组件库 功能介绍:展示ColorUI组件库概述 使用样例: ```
关于ColorUI组件库
Hi!开发者~欢迎使用ColorUI组件库!这个项目不仅有一些漂亮的基础元素,还有一些实用的组件。项目是开源的,不收取任何费用! 更多功能敬请期待!
``` ## 目录结构 ```` |---- entry | |---- common # 公共资源文件夹 | |---- images # 图片资源文件夹 | |---- pages # 示例代码文件夹 |---- colorui | |---- components # 库文件夹 | | |---- cu-custom # 自定义组件文件夹 | | |---- icon # 自定义组件文件夹 ```` ## 贡献代码 使用过程中发现任何问题都可以提 [Issue](https://gitee.com/hihopeorg/ColorUI/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/hihopeorg/ColorUI/pulls) 。 ## 开源协议 本项目基于 [MIT](https://gitee.com/hihopeorg/ColorUI/blob/master/LICENSE) ,请自由地享受和参与开源。