A vue component for verify code input.
npm install et-verify-code -S
// main.js
import EtVerifyCode from 'et-verify-code'
Vue.use(EtVerifyCode)
// demo.js
<template>
<et-verify-code @sendCodeInput="currentCode" @goNext="submitCode" :length="4" /> <!-- 属性length:验证码位数,不传则默认为4位 -->
</template>
<script>
export default {
name: 'VcodeTest',
data () {
return {
curCode: ''
}
},
methods: {
currentCode (val) {
this.curCode = val
},
submitCode () {
alert('submitCode')
}
}
}
</script>
// demo.js
<template>
<et-verify-code @sendCodeInput="currentCode" @goNext="submitCode" :length="4" /> <!-- 属性length:验证码位数,不传则默认为4位 -->
</template>
<script>
import EtVerifyCode from './components/et-verify-code.vue'
export default {
name: 'VcodeTest',
components: {
EtVerifyCode
},
data () {
return {
curCode: ''
}
},
methods: {
currentCode (val) {
this.curCode = val
},
submitCode () {
alert('submitCode')
}
}
}
</script>