当前位置:网站首页>Circulaindicator component, which makes the indicator style more diversified
Circulaindicator component, which makes the indicator style more diversified
2022-07-25 18:41:00 【51CTO】
CircleIndicator Components , Diversify indicator styles
UI Interface is an essential part of application visualization . Exquisitely designed UI The interface can make the whole visual application leave a deep impression on users , It is the most direct way to improve the user interface experience .
ArkUI The development framework provides developers with rich UI Native component , Such as Navigation(Page The root container of the page )、ScrollBar( Scroll bar assembly )、Swiper( Developers just need to focus on the implementation logic ) And Tabs( Container components that switch content views through tabs ) etc. . among ,Swiper Components and Tabs Components are introduced into the use of indicators in application development , But directly use native Swiper Components and Tabs Components are not suitable for complex UI Indicator interaction changes . therefore , We aim at Swiper Components and Tabs The component is simply encapsulated in the application direction of the indicator , With CiecleIndicator Third party components are provided in the form of application dependencies , So it improves ArkUI Development framework UI The ability of the indicator style of the interface to diversify .
CircleIndicator Introduce
CircleIndicator Components UI Effect display
Circular indicator :

Bar indicator :

Banner indicator :

Triangle indicator :

Icon indicator :

Carrying the central view Tabs Indicator :

Fixed position Tabs Indicator :

Fixed position Tabs Indicator ( Capsule style ):

Fixed position Tabs Indicator ( Carry a corner sign ):

Sliding Tabs Indicator :

Sliding Tabs Indicator ( Water drop slider ):

Sliding Tabs Indicator ( The first column is fixed ):

titles Indicator :

What is? CircleIndicator?
CircleIndicator seeing the name of a thing one thinks of its function , It refers to the circular indicator . But in us OpenHarmony In the tripartite component CircleIndicator The component is no longer a narrow circular indicator , It is a normalized indicator assembly that integrates indicators in various forms .
CircleIndicator Source code implementation
Here we have CircleIndicator In the component source code TriangularIndicator.ets The file expands the analysis for the sample object of source code analysis . First create TriangularIndicator.ets file , Use namespaces to create TriangularIndicator Initialize model :
take TriangularIndicator Application componentization :
The final will be TriangularIndicator Exposed for external reference :
CircleIndicator actual combat
Create project
As shown in the figure , stay DevEco Studio New China CircleIndicator_Test project , Project type selection Application, Language choice eTS, Click on Finish Finish creating .

Create a project
Add dependency
After successfully creating the project , The next step is to CircleIndicator Download components into the project . Please refer to how to install before adding dependencies OpenHarmony npm package (https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) complete OpenHarmony npm Environment configuration . complete OpenHarmony npm After environment configuration , stay DevEco Studio Bottom navigation bar , Click on “Terminal”( Shortcut key Alt+F12), Enter command :npm install @ohos/circle-indicator --save And return , here CircleIndicator Components are automatically downloaded into the project . After downloading, the project root directory will generate node_modules/@ohos/CircleIndicator Catalog .
Write logic code
Offer a variety of Indicator, The method of use is similar to , With TriangularIndicator For example
1. initialization : Instantiation TabsController And corresponding Indicator.Model object , And add number Type member to record the current page subscript
2. Property settings : adopt Model Class object settings UI Attributes define the desired style , You can also add the required callback
3. Interface drawing : stay Tabs Next to the component Indicator Components , Note that you need to turn off native bar. And monitor Tabs Component's touch event , Notified to Model class , To deal with sliding logic in a unified way
This period is based on OpenHarmony API8 Of CircleIndicator Components 1.0.3(https://gitee.com/openharmony-sig/CircleIndicator/tree/1.0.3) Let me introduce you to this , Welcome to participate and contribute . Learn more about the dynamics of third-party components , Please pay attention to the summary of third-party component resources (https://gitee.com/openharmony-tpc/tpc_resource), More excellent components are waiting for you to find !
边栏推荐
猜你喜欢

一周活动速递|深入浅出第8期;Meetup成都站报名进行中

从目标检测到图像分割简要发展史

The auction house is a VC, and the first time it makes a move, it throws a Web3

MySQL index optimization introduction

这届年轻人,为“丑东西”有多上头?

浏览器内核有几种,浏览器版本过低怎么升级

Combined with GHS multi, use Reza E1 simulator to realize the simulation and debugging of Reza rh850 single chip microcomputer

RTC 性能自动化工具在内存优化场景下的实践

如何创建一个有效的帮助文档?

pd.melt() vs reshape2::melt()
随机推荐
VC/PE正跑向青岛
Northeast people know sexiness best
F5:企业数字化转型所需六大能力
大厂云业务调整,新一轮战争转向
遍历数组的方法有哪些?for循环 forEach for/in for/of map的性能又有什么差别 该如何选择?
【小程序开发】页面导航详解
11.1-cm24 nearest common ancestor
Advanced software testing - test classification
拍卖行作VC,第一次出手就投了个Web3
15. Simple salary management system design
字符串函数和内存函数(二)
年轻时代,噢,年轻时代
[haoi2015] tree operation
With a market value of 30billion yuan, the largest IPO in Europe in the past decade was re launched on the New York Stock Exchange
如何创建一个有效的帮助文档?
终极套娃 2.0 | 云原生交付的封装
rust多线程安全计数
什么是hpaPaaS平台?
Combined with GHS multi, use Reza E1 simulator to realize the simulation and debugging of Reza rh850 single chip microcomputer
Powell's function of Ceres