0.5.5 • Published 6 years ago

j-vue-password v0.5.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

j-vue-password

The vue password(identifying code) component for H5.

Github

https://github.com/chuanjing/j-vue-password;

NPM

https://www.npmjs.com/package/j-vue-password;

Default style

image

Custom style

image

Installation

npm i j-vue-password
# or
cnpm i j-vue-password

Example

<template>
	<div style="padding: 50px 0;">
    <Password
      default-color="blue"
      active-color="red"
      border-radius="10px"
      :item-style="{ background: '#eee', width: '60px' }"
      :length="6"
      :auto-focus="true"
      :auto-blur="false"
      v-model="passwordVal" 
      @on-finished="onFinished"
      @on-changed="onchanged"/>
      <div style="padding: 50px;">
        <div>
          passwordVal: {{passwordVal}}
        </div>
        <div>
          onchanged: {{changedVal}}
        </div>
        <div>
          onFinished: {{finishedVal}}
        </div>
      </div>
  </div>
</template>

<script>
import Password from "j-vue-password"
export default {
	components: {
		Password: Password
  },
  data() {
    return {
      passwordVal: undefined,
      changedVal: undefined,
      finishedVal: undefined
    }
  },
  methods: {
    onFinished(val) {
      this.finishedVal = val
    },
    onchanged(val) {
      this.changedVal = val
    }
  },
}
</script>

Props

props-nametypedescdefault
lengthNumberthe length of the password6
auto-focusBooleanfocus when component mountedtrue
auto-blurBooleanblur when finished the inputfalse
v-modelNumberbind the value like input element
default-colorStringthe border & circle color when invalid"#ddd"
active-colorStringthe border & circle color when active"#BEA473"
border-radiusStringborder-radius"2px"
item-styleObjectthe style of input box{width: "50px",height:"50px", background: "#fff"}

Events

event-namedescdefault
on-changedemit the value when the value changed
on-finishedemit the value when the input finished

Issue

If you find any issue , feel free post it at https://github.com/chuanjing/j-vue-password/issues.

License

MIT

Other

Starred the "j-vue-please", if it can help you.