> For the complete documentation index, see [llms.txt](https://vuxjs.gitbook.io/vux/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vuxjs.gitbook.io/vux/shi-jian-zu-jian/miao-shu-dao-ji-shi.md).

# 秒数倒计时

## 使用场景

> 用于发送短信等耗费操作时，不要依赖前端验证，`必须一定要`同时在后端进行ratelimit验证。

* 短信验证重发的场景中。一般为60s, 120s

## API

| 参数    | 说明                          | 类型      | 默认值  |
| ----- | --------------------------- | ------- | ---- |
| time  | 可选，计时秒数                     | Number  | 60   |
| start | 可选，默认自动倒计时，设为false时可以手动开始计时 | Boolean | true |

## Demo

\`\`\` vux height=65 components=Group,Cell,Countdown

&#x20;export default { methods: { finish: function (index) { this.show = false this.value = 'completed' console.log('current index', index) } }, data () { return { show: true, value: '' } } }&#x20;

````
``` vux height=125 components=Group,Cell,Countdown,Switch
<template>
<group>
  <switch title="start" :value.sync="start"></switch>
  <cell title="15s">
    <countdown slot="value" :time="time" :start="start" @on-finish="finish"></countdown>
  </cell>
</group>
</template>

<script>
export default {
  methods: {
    finish: function (index) {
      this.start = false
      this.time = 20
    }
  },
  data () {
    return {
      time: 15,
      start: false
    }
  }
}
</script>
````
