未验证 提交 0f755a16 编写于 作者: L luoying_ace 提交者: Gitee

update zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md.

Signed-off-by: Nluoying_ace <luoying19@huawei.com>
上级 398d5062
# TapGesture
支持单次点击、多次点击识别。
支持单次多次点击识别。
> **说明:**
>
......@@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number })
| 参数名称 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
| count | number | 否 | 识别的连续点击次数。如果设置小于1,会被转化为默认值。<br/>默认值:1<br/>>&nbsp;&nbsp;**说明:**<br/>>&nbsp;如配置多击,上一次抬起和下一次按下的超时时间为300毫秒(ms)。 |
| fingers | number | 否 | 触发点击的最少手指数,最小为1指,&nbsp;最大为10指。<br/>默认值:1<br/>>&nbsp;&nbsp;**说明:**<br/>>&nbsp;1.&nbsp;当配置多指时,第一根手指按下后300毫秒(ms)内未有足够的手指数按下,手势识别失败。<br/>>&nbsp;2.&nbsp;实际点击手指数超过配置值,手势识别失败。 |
| count | number | 否 | 识别的连续点击次数。如果设置小于1,会被转化为默认值。<br/>默认值:1<br/>>&nbsp;&nbsp;**说明:**<br/>>&nbsp;如配置多击,上一次抬起和下一次按下的超时时间为300毫秒。 |
| fingers | number | 否 | 触发点击的手指数,最小为1指,&nbsp;最大为10指。<br/>默认值:1<br/>>&nbsp;&nbsp;**说明:**<br/>>&nbsp;1.&nbsp;当配置多指时,第一根手指按下后300毫秒内未有足够的手指数按下,手势识别失败。<br/>>&nbsp;2.&nbsp;实际点击手指数超过配置值,手势识别失败。 |
## 事件
......@@ -33,20 +33,25 @@ TapGesture(value?: { count?: number, fingers?: number })
@Entry
@Component
struct TapGestureExample {
@State value: string = ''
@State value: string = '';
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('Click twice')
Column() {
// 单指双击文本触发手势事件
Text('Click twice').fontSize(28)
.gesture(
TapGesture({ count: 2 })
.onAction((event: GestureEvent) => {
this.value = JSON.stringify(event.fingerList[0]);
})
)
Text(this.value)
}
.height(200).width(300).padding(60).border({ width: 1 }).margin(30)
.gesture(
TapGesture({ count: 2 })
.onAction(() => {
this.value = 'TapGesture onAction'
})
)
.height(200)
.width(300)
.padding(20)
.border({ width: 3 })
.margin(30)
}
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册