npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-verification-input

v1.0.5

Published

A input for verification code

Downloads

40

Readme

vue-verification-input

方形验证码框 支持快速粘贴

链接

demo npm

用法

$ yarn add vue-verification-input -S
# or
$ npm i vue-verification-input -S
  1. 全局组件使用

    import Vue from 'vue'
    import VerificationCodeInput from 'vue-verification-input'
    Vue.component('VerificationCodeInput', VerificationCodeInput)
  2. 局部组件

    import VerificationCodeInput from 'vue-verification-input'
    export default {
      components: {
        VerificationCodeInput
      }
    }
  3. template

    <verification-code-input
        :wrong="[Boolean]"
        :type="[String]"
        :item-class="[String]"
        :max-length="[Number]"
        item-margin="20px 10px"
        :item-active-class="[String]"
        :item-wrong-class="[String]"
        @deleteEvent="deleteEvent"
        @finishEvent="finishEvent"
    ></verification-code-input>

    | Props | 描述 | 默认值 | 必须/可选 | | ----------------- | ------------------------------ | ------ | --------- | | wrong | 用来控制验证框的状态 | false | 必须 | | type | Input 类型,一般选用 tel或text | tel | 可选 | | item-class | 单个框的样式 | 如下 | 可选 | | max-length | 输入框个数 | 6 | 可选 | | item-margin | 单个框左右和上下的间距 | 10px 0 | 可选 | | item-active-class | 单个框输入时的高亮样式 | 如下 | 可选 | | item-wrong-class | 错误回调后的每个框的高亮样式 | 如下 | 可选 |

    // item-class item-active-class item-wrong-class 的默认样式
    .item-class {
      height: 50px;
      width: 40px;
      border: 1px solid #f8f8f8;
      background: #f8f8f8;
      border-radius: 5px;
      font-size: 22px;
      color: #333333;
    }
       
    .item-active-class {
      border: 1px solid #14B9C8;
    }
       
    .item-wrong-class {
      border: 1px solid #F25A5A;
    }

    | emit | 描述 | 参数 | | ----------- | ---------------- | -------------------- | | deleteEvent | 删除事件 | 会传入删除前输入的值 | | finishEvent | 完整输入后的事件 | 会传入完成时输入的值 |

    deleteEvent(code) {
      // code 删除前输入的值
      this.wrong = false
    },
    finishEvent(code) {
      // code 完成时输入的值
      this.wrong = true
    },

    需要注意的是,props 中的 wrong 需要与两个emit 共同作用,用来在不同阶段控制输入框的状态。