1# 禁用控制 2 3组件是否可交互,可交互状态下响应[点击事件](ts-universal-events-click.md)、[触摸事件](ts-universal-events-touch.md)、[拖拽事件](ts-universal-events-drag-drop.md)、[按键事件](ts-universal-events-key.md)、[焦点事件](ts-universal-focus-event.md)和[鼠标事件](ts-universal-mouse-key.md)。 4 5> **说明:** 6> 7> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8 9 10## 属性 11 12 13| 名称 | 参数类型 | 默认值 | 描述 | 14| ------- | ------- | ---- | ---------------------------------------- | 15| enabled | boolean | true | 值为true表示组件可交互,响应点击等操作。<br>值为false表示组件不可交互,不响应点击等操作。<br>默认值:true | 16 17 18## 示例 19 20```ts 21// xxx.ets 22@Entry 23@Component 24struct EnabledExample { 25 build() { 26 Flex({ justifyContent: FlexAlign.SpaceAround }) { 27 // 点击没有反应 28 Button('disable').enabled(false).backgroundColor(0x317aff).opacity(0.4) 29 Button('enable').backgroundColor(0x317aff) 30 } 31 .width('100%') 32 .padding({ top: 5 }) 33 } 34} 35``` 36 37 38