Skip to content

useCountDown

倒计时

基础用法

<template>
  <div>当前值:{{ count }}</div>
  <g-button @click="start">开始</g-button>
  <g-button @click="stop">暂停</g-button>
  <g-button @click="destory">destory</g-button>

</template>

<script setup lang="ts">
import { GButton, useCountDown } from "gao-components-plus";

const { count, stop, start, destory } = useCountDown({ startCount: 10 })

</script>

<style lang="scss" scoped>

</style>

参数

名称描述类型默认值
options配置项,见以下Options配置Object-

Options配置

名称描述类型默认值
startCount起始值number-
endCount结束值number-
step每次倒计时步长number-

返回参数

名称描述类型默认值
count当前数量number-
stop暂停Function-
start开始Function-
destory销毁Function-

Released under the MIT License.