UNPKG
dify-components
Version:
latest (1.0.0)
1.0.0
This is a modern component library template based on Turborepo+Vue 3.5+TypeScript.
dify-components
/
packages
/
hooks
/
src
/
useCounter
/
index.ts
20 lines
(15 loc)
•
276 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import
{ ref }
from
'vue'
;
export
function
useCounter
(
initialValue =
0
) {
const
count =
ref
(initialValue);
const
increment
= (
) => { count.
value
++; };
const
decrement
= (
) => { count.
value
--; };
return
{ count, increment, decrement, }; }