{"id":22022689,"url":"https://github.com/cj/vuelidation","last_synced_at":"2025-05-07T07:22:54.424Z","repository":{"id":66691155,"uuid":"89006938","full_name":"cj/vuelidation","owner":"cj","description":"simple, powerful, vuejs validation.","archived":false,"fork":false,"pushed_at":"2019-03-26T02:42:08.000Z","size":144,"stargazers_count":36,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-29T11:14:00.015Z","etag":null,"topics":["form","validation","vue","vuejs","vuejs2"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-21T17:12:04.000Z","updated_at":"2023-08-19T18:56:39.000Z","dependencies_parsed_at":"2023-06-03T20:15:12.652Z","dependency_job_id":null,"html_url":"https://github.com/cj/vuelidation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fvuelidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fvuelidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fvuelidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fvuelidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cj","download_url":"https://codeload.github.com/cj/vuelidation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227284641,"owners_count":17758434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["form","validation","vue","vuejs","vuejs2"],"created_at":"2024-11-30T06:22:26.886Z","updated_at":"2024-11-30T06:22:27.387Z","avatar_url":"https://github.com/cj.png","language":"JavaScript","funding_links":[],"categories":["UI实用程序","Components \u0026 Libraries","UI Utilities","UI Utilities [🔝](#readme)"],"sub_categories":["形成","UI Utilities","Form"],"readme":"\u003ch1 align=\"center\"\u003eVuelidation ✅\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cq\u003esimple, powerful, vuejs validation.\u003c/q\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/cj/vuelidation\"\u003e\u003cimg src=\"https://img.shields.io/travis/cj/vuelidation/master.svg\" alt=\"Build Status\" target=\"_blank\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/cj/vuelidation?branch=master\"\u003e\u003cimg src=\"https://img.shields.io/coveralls/cj/vuelidation/master.svg\" alt=\"Coverage Status\" target=\"_blank\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vuelidation\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/vuelidation.svg\" alt=\"Downloads\" target=\"_blank\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://gitter.im/cj/vuelidation\"\u003e\u003cimg src=\"https://img.shields.io/badge/GITTER-join%20chat-green.svg\" alt=\"Gitter\" target=\"_blank\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/cj/vuelidation/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/vuelidation.svg\" alt=\"License\" target=\"_blank\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  ✨ \u003ca href=\"https://codepen.io/cj/pen/BRNzgd\"\u003eExample\u003c/a\u003e✨\n\u003c/p\u003e\n\n**Install**\n\n`yarn add --dev vuelidation@latest`\n\n**Include Plugin**\n```javascript\nimport Vue from 'vue';\nimport Vuelidation from 'vuelidation';\n\nVue.use(Vuelidation);\n```\n**Use**\n```vue\n\u003cscript\u003e\n  new Vue({\n    data () {\n      return {\n        name: '',\n      }\n    },\n    \n    vuelidation: {\n      data: {\n        name: {\n          required: true,\n        },\n      },\n    },\n    \n    methods: {\n      submit () {\n        if (this.$vuelidation.valid()) {\n          console.log(`Hello, ${this.name}!`)\n        }\n      }\n    }\n  })\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cform\u003e\n    \u003cinput type='text' v-model='name' /\u003e\n    \u003cdiv v-if='$vuelidation.error(\"name\")'\u003e{{ $vuelidation.error('name') }}\u003c/div\u003e\n    \n    \u003cbutton type=\"submit\" :disabled=\"$vuelidation.errors()\"\u003eSubmit\u003c/button\u003e\n  \u003c/form\u003e\n\u003c/template\u003e\n```\n\n## Validations\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-alphabetic'\u003e\u003cb\u003ealphabetic\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003eMust be a alphabetic value\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003eargs:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  alphabetic: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-alpha'\u003e\u003cb\u003ealpha\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003eMust only contain letters and numbers\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003eargs:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  alpha: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-alphaDash'\u003e\u003cb\u003ealphaDash\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must only contain letters, numbers, underscores or dashes\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  alphaDash: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-alphaSpace'\u003e\u003cb\u003ealphaSpace\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must only contain letters, numbers or spaces\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  alphaSpace: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-length'\u003e\u003cb\u003elength\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must be {{ length }} character(s)\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Number\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  length: 16,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-between'\u003e\u003cb\u003ebetween\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must be between {{ min }} and {{ max }}\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e { min: Number, max: Number }\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  between: {\n    min: 5,\n    max: 10,\n  },\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-between-length'\u003e\u003cb\u003ebetweenLength\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must have between {{ min }} and {{ max }} characters\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e { min: Number, max: Number }\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  betweenLength: {\n    min: 8,\n    max: 20,\n  },\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-decimal'\u003e\u003cb\u003edecimal\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must be a decimal\u003c% if (points \u0026\u0026 points !== \"*\") { %\u003e with {{ points }} points\u003c% } %\u003e\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e { points: *Number }\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  decimal: {\n    points: 2,\n  },\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-email'\u003e\u003cb\u003eemail\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Not a valid email\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  email: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003ca href='#validations-includes'\u003e\u003cb\u003eincludes\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e {{ value }} is not one of the following: {{ values.join(\", \") }}\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e { includes: Array }\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  includes: ['foo', 'bar'],\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-numeric'\u003e\u003cb\u003enumeric\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Must be a numeric value\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  numeric: true,\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  \u003ca href='#validations-required'\u003e\u003cb\u003erequired\u003c/b\u003e\u003c/a\u003e\n  \u003cp style='margin: 0; '\u003e\n    \u003cul style='margin: 0; padding: 0; list-style-type: none;'\u003e\n      \u003cli\u003e\u003cb\u003emsg:\u003c/b\u003e Required\u003c/li\u003e\n      \u003cli\u003e\u003cb\u003earg:\u003c/b\u003e Boolean\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/p\u003e\n\u003c/summary\u003e\n\n```javascript\n{\n  required: true,\n}\n```\n\u003c/details\u003e\n\n\u003cb\u003e*\u003c/b\u003e - the **arg** is optional.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcj%2Fvuelidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcj%2Fvuelidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcj%2Fvuelidation/lists"}