当前位置:网站首页>openharmony容器组件之Counter
openharmony容器组件之Counter
2022-08-09 13:12:00 【lplj717】
Counter:计数器组件,提供相应的增加或者减少的计数操作
事件
onInc(event: () => void) 监听数值增加事件
onDec(event: () => void) 监听数值减少事件
效果如图:
代码:
@Entry
@Component
struct CounterT {
@State value: number = 0
build() {
Column() {
Counter() {
Text(this.value.toString())
}.margin(100)
.onInc(() => {
this.value++
})
.onDec(() => {
this.value--
})
}
.width('100%')
.height('100%')
}
}
边栏推荐
- 处理XML,dom4j的简单使用
- Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
- pytest 之 fixture参数化
- NC15 求二叉树的层序遍历
- 昇腾AI开发者创享日南京站!一起CANN机器狗+AI机械臂实现硬核智慧救援!燃爆现场~
- X264性能优化
- Draw a histogram with plot_hist_numeric()
- puzzle(016.5)逻辑电路
- 【奖励公示】第23期 2022年7月奖励名单公示:社区明星评选 | 新人奖 | 博客同步 | 推荐奖
- Deep Learning Based on R Language - Simple Regression Case
猜你喜欢
随机推荐
FFmpeg multimedia file processing (FFMPEG logging system)
NC53 删除链表的倒数第n个节点
pytest 之 重运行机制与测试报告
激光器如何养护才能远离结露没烦恼
opencv-matchTemplate 之使用场景为大图里面找小图
KMP方法
Draw a histogram with plot_hist_numeric()
关于做2D游戏时,Canvas边界显示在Game窗口的问题
【奖励公示】第23期 2022年7月奖励名单公示:社区明星评选 | 新人奖 | 博客同步 | 推荐奖
LeetCode 37. Solve Sudoku
FFmpeg相机花屏花图问题解决方法
Deep Learning Based on R Language - Simple Regression Case
蓝桥历届真题-既约分数
RobotFramework 之 RF变量与标准库关键字使用
The sword refers to Offer 56 - II. Number of occurrences of a number in an array II (bit operation)
Q_04_07 进一步探索
二叉树的遍历(py)
处理XML,dom4j的简单使用
GET POST PUT DELETE request in GIN
蓝桥历届真题-蛇形填数