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 | - |
