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

form-validate-vue

v1.0.6

Published

A validate module for vue. It aims to give a convenient way to validate vue data. It use mixins to inject to vue instance.

Downloads

4

Readme

form-validate-vue

A validate module for vue. It aims to give a convenient way to validate vue data. It use mixins to inject to vue instance.

Github: https://github.com/liu75675231/form-validate-vue

Live example: https://codesandbox.io/s/quirky-mccarthy-n15oe?file=/src/App.vue

If you have trouble using that plugin. please send a feecback email to [email protected]. Thanks

Install

npm i form-validate-vue

Usage

Basic usage involves initiation, validate when blur or input form changed, validate all data.

Javascript

import FormValidate from "form-validate-vue"
new Vue({
    mixins: [ FormValidate.single ],
    created: function () {
      this.svfInit(this.form, this, () => {
            return {
              lang: "en-US",
              conf: {
                name: {
                  text: "Name",
                  nodeName: "input",
                  rules: ["required"]
                },
                email: {
                  text: "Email",
                  nodeName: "input",
                  rules: ["email"]
                },
                source: {
                  nameName: "select",
                  text: "Source",
                  rules: ["required"]
                },
                gender: {
                  nameName: "select",
                  text: "Gender",
                  rules: [
                    {
                      required: 0
                    }
                  ]
                }
              }
            };
          });
    }
})

HTML

<input type="text"  v-on:change="svfOnTextFieldBlur('Source', data.form.Source)" />
<div>{{ svfGetValidateMsg('Source') }}</div>

Validate all data

this.svfValidate(form)

Initiation configuration:

lang: the language it shown when it has error. it only support "zh-CN" and "en-US"

conf: each form validate configuration you config is here.

text: the name that is shown in which error message

nodeName: the value is "select" or "input" represent the input or select form item.

rules: it is array, all of the validate rule in it.

Rules

Required: it represent that something is required and not be empty. You can config that using

rules: ['required']

or

rules: [
  {
    required: 0,
  }
]

The latter number 0 means that the number 0 is judged that is empty and validate failture.

Email: check whether the value you input is a valid email format

rules: ['email']