# useThrottle

#### 基础用法

```html
<template>
  <p>Count: {{ count }}</p>

  <button @click="handleClick">Increment</button>
  <p>throttledSetCount:{{ throttledSetCount }}</p>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { useThrottle } from 'hooks-vue3';
const count = ref<number>(0);
const handleClick = () => {
  count.value = count.value + 1;
};
const throttledSetCount = useThrottle<number>(count, {
  wait: 1000,
});
</script>
l
```

### API

```typescript
import type { ThrottleSettings } from 'lodash-es/throttle';
interface UseThrottleOptions extends ThrottleSettings {
  wait?: number;
}
const throttleValue = useThrottle(value:T,{ wait: Options });
```

### 参数

* value (T): 要节流的值。
* \[wait=0] (number): 需要节流的毫秒。
* \[options=] (Object): 选项对象
* \[options.leading=false] (boolean): 指定调用在节流开始前。
* \[options.trailing=true] (boolean): 指定调用在节流结束后。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://laterly.gitbook.io/hooks-vue3/usethrottle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
