# 点击控制

> phone 12+ | 2in1 13+ | tablet 12+ | tv 19+ | wearable 18+

用于根据交互需求设置组件是否可以响应点击事件、触摸事件等手指交互事件，满足不同场景下对组件交互响应的控制需求。
> 说明
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口，采用上角标单独标记接口的起始版本。

## touchable^(deprecated)^

> phone 12+ | 2in1 13+ | tablet 12+ | tv 19+ | wearable 18+

touchable(value: boolean): T

设置当前组件的交互响应能力。
> 说明
>
> 从API version 7开始支持，从API version 9开始废弃，建议使用[hitTestBehavior](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-hit-test-behavior#hittestbehavior)替代。

**系统能力：** SystemCapability.ArkUI.ArkUI.Full

**参数：**

|参数名|类型|必填|说明|
|:----|:------|:-|:-------------------------------------------------------------------|
|value|boolean|是|设置当前组件是否可以响应点击事件、触摸事件等手指交互事件。 默认值：true，可以响应交互事件。设置为false时，不可以响应交互事件。|

**返回值：**

|类型|说明|
|:-|:------|
|T|返回当前组件。|

## 示例

> phone | 2in1 | tablet | tv | wearable

```ts
// xxx.ets
@Entry
@Component
struct TouchableExample {
  @State text1: string = '';
  @State text2: string = '';

  build() {
    Stack() {
      Rect()
        .fill(Color.Gray).width(150).height(150)
        .onClick(() => {
          console.info(this.text1 = 'Rect Clicked');
        })
        .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
      Ellipse()
        .fill(Color.Pink).width(150).height(80)
        .touchable(false) // 点击Ellipse区域，不会打印 "Ellipse Clicked"
        .onClick(() => {
          console.info(this.text2 = 'Ellipse Clicked');
        })
        .overlay(this.text2, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
    }.margin(100);
  }
}
```

![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/dd/v3/MD4sFF1WROmB1r7fPWOYYg/zh-cn_image_0000002768022846.gif?HW-CC-KV=V1&HW-CC-Date=20261019T062624Z&HW-CC-Expire=31536000000&HW-CC-Sign=844917397AC687F1FD544A8A0F6A631147372960919FDE6A35321B0D7CCA1899)

