UNPKG

lighting-ui

Version:

A rich interaction, lightweight, high performance UI library based on Weex

81 lines (64 loc) 1.95 kB
# lc-captchafield > 带有发送验证码的输入框 ## [Demo](http://res.lightyy.com/lightui/example/captchafield/?_wx_tpl=http%3A%2F%2Fres.lightyy.com%2Flightui%2Fexample%2Fcaptchafield%2Findex.native.js) <img src="./captchafield.png" width="240"/> <img src="./captchafield-scan.png" width="160"> ## 使用方法 ```vue <template> <div class="wxc-demo"> <title title="lc-captchafield"></title> <div class="container"> <category title="发送验证码"></category> <div class="form"> <lc-captchafield ref="input" :time=30 @sendCaptcha="sendHandler"></lc-captchafield> </div> </div> </div> </template> <style scoped> .wxc-demo { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-color: #FFFFFF; } .container{ flex-direction: column; align-items: center; } .form{ width: 600px; } </style> <script> import { LcCaptchafield } from '../../index'; import Title from '../_mods/title.vue'; import Category from '../_mods/category.vue'; export default { components: { Title, Category, LcCaptchafield }, data: () => ({ }), created () { }, methods: { sendHandler(){ console.log('点击发送验证码'); this.$refs['input'].countDown(); } } }; </script> ``` ### API | Prop | Type | Required | Default | Description | | ---- |:----:|:---:|:-------:| :----------:| | **`placeholder`** | `String` | `N` | ` ` | `提示文本` | | **`disabled`** | `Boolean` | `N` | `false` | `是否禁用` | | **`autofocus`** | `Boolean` | `N` | `false` | `是否自动聚焦` | | **`maxlength`** | `Number` | `N` | ` ` | `输入最大长度` | | **`time`** | `Number` | `N` | `90` | `再次获取验证码的间隔时间` | | **`sendCaptcha`** | `Function` | `Y` | ` ` | `点击获取验证码的回调函数` | - *1:使用`this.$refs['input'].countDown()`调用组件的倒计时方法