1.0.7 • Published 1 month ago

sms-code-input v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

SMS-CODE-INPUT

SMS code input component for Vue2

vue2 license npm

sms-code-input is a dependency-free, lightweight vue component that can be overwrited by yourself.

Usage

When you use it, you need to wrapper this component by an exact size container or element. (e.g: use div with definitely width)

step-1

vue create demo

step-2

cd demo
npm install sms-code-input

Example

npm run serve
<template>
  <div style="width: 300px">
    <sms-code-input 
      :digits="counts"
      :color="color"
      :styles="styles"
      @change="onInputChange" 
      @complete="onInputComplete"
    >
    </sms-code-input>
  </div>
</template>
<script>
export default {
  data() {
    return {
      counts: 4,
      color: '#409eff',
      styles: {
        height: '50px',
        width: '30px',
        fontSize: '20px',
        color: '#275edb'
      }
    }
  },
  methods: {
    onInputChange(val) {
      console.log('input change: --->', val)
    },
    onInputComplete(val) {
      console.log('input complete: --->', val)
    }
  }
}
</script>

Options

PropertyDescriptiontypedefault
digitsthe code numbers for the SMSNumber6
colorthe input border colorString'#af3737'
stylesthe custom styles for the inputObject{}

Functions

Function NameDescription
changetrigger when input code changed
completetirgger when input code completed
1.0.7

1 month ago

1.0.6

1 month ago

1.0.5

1 month ago

1.0.4

1 month ago

1.0.3

1 month ago

1.0.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago

0.1.0

1 month ago