/*! For license information please see 9456.5caef5ad.js.LICENSE.txt */
(self.webpackChunk=self.webpackChunk||[]).push([["9456"],{52238:function(s,n,a){"use strict";a.r(n);var t=a("80681");let l=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
useCountDown
\nIntro
\n
Used to manage the countdown.
\n
Usage
\nBasic Usage
\n
<span>Total time\uFF1A{{ current.total }}</span>\n<span>Remain days\uFF1A{{ current.days }}</span>\n<span>Remain hours\uFF1A{{ current.hours }}</span>\n<span>Remain minutes\uFF1A{{ current.minutes }}</span>\n<span>Remain seconds\uFF1A{{ current.seconds }}</span>\n<span>Remain milliseconds\uFF1A{{ current.milliseconds }}</span>\n
\n
import { useCountDown } from '@vant/use';\n\nexport default {\n setup() {\n const countDown = useCountDown({\n time: 24 * 60 * 60 * 1000,\n });\n\n countDown.start();\n\n return {\n current: countDown.current,\n };\n },\n};\n
\n
Millisecond
\n
import { useCountDown } from '@vant/use';\n\nexport default {\n setup() {\n const countDown = useCountDown({\n time: 24 * 60 * 60 * 1000,\n millisecond: true,\n });\n countDown.start();\n\n return {\n current: countDown.current,\n };\n },\n};\n
\n
API
\nType Declarations
\n
type CurrentTime = {\n days: number;\n hours: number;\n total: number;\n minutes: number;\n seconds: number;\n milliseconds: number;\n};\n\ntype CountDown = {\n start: () => void;\n pause: () => void;\n reset: (totalTime: number) => void;\n current: ComputedRef<CurrentTime>;\n};\n\ntype UseCountDownOptions = {\n time: number;\n millisecond?: boolean;\n onChange?: (current: CurrentTime) => void;\n onFinish?: () => void;\n};\n\nfunction useCountDown(options: UseCountDownOptions): CountDown;\n
\n
Params
\n
\n\n\nName | \nDescription | \nType | \nDefault Value | \n
\n\n\n\ntime | \nTotal time, unit milliseconds | \nnumber | \n- | \n
\n\nmillisecond | \nWhether to enable millisecond render | \nboolean | \nfalse | \n
\n\nonChange | \nTriggered when count down changed | \n(current: CurrentTime) => void | \n- | \n
\n\nonFinish | \nTriggered when count down finished | \n() => void | \n- | \n
\n\n
\n
Return Value
\n
\n\n\nName | \nDescription | \nType | \n
\n\n\n\ncurrent | \nCurrent remain time | \nCurrentTime | \n
\n\nstart | \nStart count down | \n() => void | \n
\n\npause | \nPause count down | \n() => void | \n
\n\nreset | \nReset count down | \n(time?: number): void | \n
\n\n
\n
CurrentTime Structure
\n
\n\n\nName | \nDescription | \nType | \n
\n\n\n\ntotal | \nTotal time, unit milliseconds | \nnumber | \n
\n\ndays | \nRemain days | \nnumber | \n
\n\nhours | \nRemain hours | \nnumber | \n
\n\nminutes | \nRemain minutes | \nnumber | \n
\n\nseconds | \nRemain seconds | \nnumber | \n
\n\nmilliseconds | \nRemain milliseconds | \nnumber | \n
\n\n
\n
'},null,8,l))}}}]);