1.0.4 • Published 7 years ago

vue-custom-inputs v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Vue custom input version vue downloads

NPM

Vue custom input is a vue component for custom split input box, mobile web input box, simulating native app input box and etc. It's designed to input password and verification code. But you can also use it in other situation as you wish.

npm.io

Demo

https://youjingyu.github.io/vue-custom-input/dist/example/

Installation

npm i vue-custom-inputs -S

Usage

use in vue single file components

<template>
    <custom-input
        input-height="50px"
        :input-number="4"
        input-type="number"
        input-style-type="oneBorder"
        @custom-input-change="change"
        @custom-input-complete="complete">
    </custom-input>
</template>
<script>
    import customInput from 'vue-custom-input';
    export default {
        components: { 'custom-input': customInput },
        methods: {
            change(val) {
                
            },
            complete(val) {
                
            }
        }
    }
</script>

use in browser globals

<div id="app">
    <custom-input></custom-input>
</div>
<script src="vue.js"></script>
<script src="vue-custom.js"></script>
<script>
     new Vue({
        el: '#app',
        components: {
            'custom-input': window.customInput
        }
     });
</script>

API

Vue custom input component attributes:

Attr. NameDescriptionRequiredTypeDefault Value
custom-input-changecalled when input value is changedNFunction-
custom-input-completecalled when all input boxes are filledNFunction-
input-numberinput box numberNNumber4
input-style-typetwo preset styles. You can also design your style by the following attributesN'allBorder', 'oneBorder''allBorder'
input-typejust like html5 input type attribute, can be tel, number, text and etc.NString'text'
password-charthe character showed in input box when the input-type is passwordNString'*'
input-widthinput box widthNString-
input-heightinput box heightNString'50px'
input-border-widthinput box border widthNString'1px'
input-border-colorinput box border colorNString'#20A0FF'
input-active-outline-colorinput box outline color when focus on itNString'#58B7FF'
input-stylecustomize input box style as you want. All styles will be injected into box's style attributeNObject{}
input-active-styleinput box style when focus on it. All styles will be injected into box's style attributeNObject{}