Skip to content

useCounter

具有实用函数的基本计数器。

¥Basic counter with utility functions.

示例

Count: 0

基本用法

¥Basic Usage

ts
import { 
useCounter
} from '@vueuse/core'
const {
count
,
inc
,
dec
,
set
,
reset
} =
useCounter
()

与选项一起使用

¥Usage with options

ts
import { 
useCounter
} from '@vueuse/core'
const {
count
,
inc
,
dec
,
set
,
reset
} =
useCounter
(1, {
min
: 0,
max
: 16 })