---
name: "enableRule"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.7.60" }
title: "enableRule - 开启已绑定规则"
---

## enableRule

> [VERSION] @ray-js/ray >= 1.7.60

### 描述

开启已绑定规则，恢复规则的自动执行

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `params` | `IRuleIdParams` | 是 | 启用规则参数 |

### 返回值

类型: `Promise<boolean>`

是否操作成功

### 引用对象

##### `interface` IRuleIdParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `ruleId` | `string` | 规则 ID |


### 示例代码

```typescript
import { enableRule } from '@ray-js/ray';

const enableSceneRule = async () => {
  try {
    const success = await enableRule({
      ruleId: 'rule_001',
    });
    console.log('开启规则结果:', success);
  } catch (err) {
    console.error('开启失败:', err);
  }
};
```
