/*! For license information please see 5395.d50f37e0.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["5395"],{66440: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:'
\u7528\u4E8E\u5B9E\u65F6\u5C55\u793A\u5012\u8BA1\u65F6\u6570\u503C\uFF0C\u652F\u6301\u6BEB\u79D2\u7CBE\u5EA6\u3002
\n\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002
\nimport { createApp } from 'vue';\nimport { CountDown } from 'vant';\n\nconst app = createApp();\napp.use(CountDown);\n
\ntime
\u5C5E\u6027\u8868\u793A\u5012\u8BA1\u65F6\u603B\u65F6\u957F\uFF0C\u5355\u4F4D\u4E3A\u6BEB\u79D2\u3002
<van-count-down :time="time" />\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const time = ref(30 * 60 * 60 * 1000);\n return { time };\n },\n};\n
\n\u901A\u8FC7 format
\u5C5E\u6027\u8BBE\u7F6E\u5012\u8BA1\u65F6\u6587\u672C\u7684\u5185\u5BB9\u3002
<van-count-down :time="time" format="DD \u5929 HH \u65F6 mm \u5206 ss \u79D2" />\n
\n\u5012\u8BA1\u65F6\u9ED8\u8BA4\u6BCF\u79D2\u6E32\u67D3\u4E00\u6B21\uFF0C\u8BBE\u7F6E millisecond
\u5C5E\u6027\u53EF\u4EE5\u5F00\u542F\u6BEB\u79D2\u7EA7\u6E32\u67D3\u3002
<van-count-down millisecond :time="time" format="HH:mm:ss:SS" />\n
\n\u901A\u8FC7\u63D2\u69FD\u81EA\u5B9A\u4E49\u5012\u8BA1\u65F6\u7684\u6837\u5F0F\uFF0CtimeData
\u5BF9\u8C61\u683C\u5F0F\u89C1\u4E0B\u65B9\u8868\u683C\u3002
<van-count-down :time="time">\n <template #default="timeData">\n <span class="block">{{ timeData.hours }}</span>\n <span class="colon">:</span>\n <span class="block">{{ timeData.minutes }}</span>\n <span class="colon">:</span>\n <span class="block">{{ timeData.seconds }}</span>\n </template>\n</van-count-down>\n\n<style>\n .colon {\n display: inline-block;\n margin: 0 4px;\n color: #1989fa;\n }\n .block {\n display: inline-block;\n width: 22px;\n color: #fff;\n font-size: 12px;\n text-align: center;\n background-color: #1989fa;\n }\n</style>\n
\n\u901A\u8FC7 ref \u83B7\u53D6\u5230\u7EC4\u4EF6\u5B9E\u4F8B\u540E\uFF0C\u53EF\u4EE5\u8C03\u7528 start
\u3001pause
\u3001reset
\u65B9\u6CD5\u3002
<van-count-down\n ref="countDown"\n millisecond\n :time="3000"\n :auto-start="false"\n format="ss:SSS"\n @finish="onFinish"\n/>\n<van-grid clickable>\n <van-grid-item text="\u5F00\u59CB" icon="play-circle-o" @click="start" />\n <van-grid-item text="\u6682\u505C" icon="pause-circle-o" @click="pause" />\n <van-grid-item text="\u91CD\u7F6E" icon="replay" @click="reset" />\n</van-grid>\n
\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const countDown = ref(null);\n\n const start = () => {\n countDown.value.start();\n };\n const pause = () => {\n countDown.value.pause();\n };\n const reset = () => {\n countDown.value.reset();\n };\n const onFinish = () => showToast('\u5012\u8BA1\u65F6\u7ED3\u675F');\n\n return {\n start,\n pause,\n reset,\n onFinish,\n countDown,\n };\n },\n};\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
time | \n\u5012\u8BA1\u65F6\u65F6\u957F\uFF0C\u5355\u4F4D\u6BEB\u79D2 | \nnumber | string | \n0 | \n
format | \n\u65F6\u95F4\u683C\u5F0F | \nstring | \nHH:mm:ss | \n
auto-start | \n\u662F\u5426\u81EA\u52A8\u5F00\u59CB\u5012\u8BA1\u65F6 | \nboolean | \ntrue | \n
millisecond | \n\u662F\u5426\u5F00\u542F\u6BEB\u79D2\u7EA7\u6E32\u67D3 | \nboolean | \nfalse | \n
\u683C\u5F0F | \n\u8BF4\u660E | \n
---|---|
DD | \n\u5929\u6570 | \n
HH | \n\u5C0F\u65F6 | \n
mm | \n\u5206\u949F | \n
ss | \n\u79D2\u6570 | \n
S | \n\u6BEB\u79D2\uFF081 \u4F4D\uFF09 | \n
SS | \n\u6BEB\u79D2\uFF082 \u4F4D\uFF09 | \n
SSS | \n\u6BEB\u79D2\uFF083 \u4F4D\uFF09 | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
finish | \n\u5012\u8BA1\u65F6\u7ED3\u675F\u65F6\u89E6\u53D1 | \n- | \n
change | \n\u5012\u8BA1\u65F6\u53D8\u5316\u65F6\u89E6\u53D1 | \ncurrentTime: CurrentTime | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
default | \n\u81EA\u5B9A\u4E49\u5185\u5BB9 | \ncurrentTime: CurrentTime | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n
---|---|---|
total | \n\u5269\u4F59\u603B\u65F6\u95F4\uFF08\u5355\u4F4D\u6BEB\u79D2\uFF09 | \nnumber | \n
days | \n\u5269\u4F59\u5929\u6570 | \nnumber | \n
hours | \n\u5269\u4F59\u5C0F\u65F6 | \nnumber | \n
minutes | \n\u5269\u4F59\u5206\u949F | \nnumber | \n
seconds | \n\u5269\u4F59\u79D2\u6570 | \nnumber | \n
milliseconds | \n\u5269\u4F59\u6BEB\u79D2 | \nnumber | \n
\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 CountDown \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
start | \n\u5F00\u59CB\u5012\u8BA1\u65F6 | \n- | \n- | \n
pause | \n\u6682\u505C\u5012\u8BA1\u65F6 | \n- | \n- | \n
reset | \n\u91CD\u8BBE\u5012\u8BA1\u65F6\uFF0C\u82E5 auto-start \u4E3A true \uFF0C\u91CD\u8BBE\u540E\u4F1A\u81EA\u52A8\u5F00\u59CB\u5012\u8BA1\u65F6 | \n- | \n- | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n CountDownProps,\n CountDownInstance,\n CountDownCurrentTime,\n} from 'vant';\n
\nCountDownInstance
\u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A
import { ref } from 'vue';\nimport type { CountDownInstance } from 'vant';\n\nconst countDownRef = ref<CountDownInstance>();\n\ncountDownRef.value?.start();\n
\n\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 ConfigProvider \u7EC4\u4EF6\u3002
\n\u540D\u79F0 | \n\u9ED8\u8BA4\u503C | \n\u63CF\u8FF0 | \n
---|---|---|
--van-count-down-text-color | \nvar(--van-text-color) | \n- | \n
--van-count-down-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-count-down-line-height | \nvar(--van-line-height-md) | \n- | \n
\u5982\u679C\u4F60\u9047\u5230\u4E86\u5728 iOS \u4E0A\u5012\u8BA1\u65F6\u4E0D\u751F\u6548\u7684\u95EE\u9898\uFF0C\u8BF7\u786E\u8BA4\u5728\u521B\u5EFA Date \u5BF9\u8C61\u65F6\u6CA1\u6709\u4F7F\u7528new Date(\'2020-01-01\')
\u8FD9\u6837\u7684\u5199\u6CD5\uFF0CiOS \u4E0D\u652F\u6301\u4EE5\u4E2D\u5212\u7EBF\u5206\u9694\u7684\u65E5\u671F\u683C\u5F0F\uFF0C\u6B63\u786E\u5199\u6CD5\u662Fnew Date(\'2020/01/01\')
\u3002
\u5BF9\u6B64\u95EE\u9898\u7684\u8BE6\u7EC6\u89E3\u91CA\uFF1Astackoverflow\u3002
\n