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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-light-verify

v1.0.3

Published

一个轻量级的 VUE 表单验证插件,并且有可以使用输入限制

Readme

vue-light-verify

一个轻量级的 VUE 表单验证插件,并且有可以使用输入限制

Installation

npm install vue-light-verify

#Usage

const import Vue from 'vue'
const import LightVerify from 'vue-light-verify'
Vue.use(LightVerify, options)

// 组件中 
data () {
    vaOptions: {
        errorClass: 'error'
    }
}

rules: {
    username: 'required',
    phone: {
        test: 'required',
        message: '手机号码是必填'
    },
    bankName: [
        'required',
        {
            test: /.{5,12}/g,
            message: '银行姓名格式错误'
        }
    ],
    password: {
        test: function(val) {
            if (val == 123) {
                return false;
            } else {
                return true;
            }
        },
        message: '密码不能为123'
    }
}

Domo&Document

  • 指令 v-va
  • 输入限制 示例 v-va:Number 只能输入数字,目前只有四个 Number、Chinese、CeAndLe(字母、数字)、Letter
  • 使用输入验证时,v-model后必须跟修饰符lazy
  • rules中的key名、data中的key、v-va组件传入的字符串,三者名称需保持一致

| 名称 | 类型 | 描述 | | :----: |:----:|:------:| | $lightVerify| Object | 插件挂载的属性 | | $errors | Object | 存放验证失败的字段 | | check | function | 触发验证 | | valid | Boolean | 是否验证通过 |

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>
    <div class="input_box">
      <input type="text" id="test" class="ddd" v-model.lazy="username" v-va:CeAndLe="username"> {{error.username}}
      <input type="text" v-model.lazy="phone" v-va:Number="phone"> {{error.phone}}
      <input type="text" v-model.lazy="bankName" v-va:Chinese="bankName">{{error.bankName[0]}}
      <input type="text" v-model="password" v-va="password">{{error.password}}
      <button @click="showError">提交</button>
    </div>
  </div>
</template>

<script>
export default {
    name: "HelloWorld",
    data() {
        return {
            msg: "Welcome to Your Vue.js App",
            username: '',
            phone: '',
            bankName: '',
            password: '',
            vaOptions: {
                errorClass: 'error'
            }
        };
    },

    computed: {
        error () {
            return this.$lightVerify.$errors;
        }
    },
    
    rules: {
        username: 'required',
        phone: {
            test: 'required',
            message: '手机号码是必填'
        },
        bankName: [
            'required',
            {
                test: /.{5,12}/g,
                message: '银行姓名格式错误'
            }
        ],
        password: {
            test: function(val) {
                if (val == 123) {
                    return false;
                } else {
                    return true;
                }
            },
            message: '密码不能为123'
        }
    },

    methods: {
        showError () {
            this.$lightVerify.check();
        },
    },
};
</script>

<style scoped>

.input_box {
    width: 500px;
    margin: 0 auto;
}

input {
    height: 50px;
    width: 100%;
    margin-bottom: 20px;
    outline: none;
    padding-left: 10px;
    font-size: 20px;
}

.error {
    border: 1px solid red;
}
</style>