<template>
<div>
<p style="marginTop: 16"> Clicked count: {{debounceFnValue}} </p>
<button type="button" @click="debounceFnRun">
useDebounceFn测试
</button>
</div>
</template>
<script lang="ts">
import { ref } from 'vue';
import { useDebounceFn } from 'v3hooks';
export default {
name: "HelloWorld",
props: {
msg: String,
},
setup() {
const debounceFnValue = ref<number>(1);
const { run:debounceFnRun } = useDebounceFn(()=>{
debounceFnValue.value++
},500)
return {
debounceFnValue,
debounceFnRun,
}
}
}
</script>