赞
踩
vue.js表单验证
Validation Forms for Vue.js.
Vue.js的验证表单。
npm install willvalidate --save
- import Vue from 'Vue'
- import willvalidate from 'willvalidate'
- Vue.use(willvalidate)
- export default {
- methods:{
- sendForm()
- {
- this.willvalidate( document.querySelector("#form") ) ? console.log("ok") : console.log("error")
- }
- }
- }
<script src="./PATH/node_modules/willvalidate/dist/willvalidate.js"></script>
Ex: require, maxlength, minlength, type, pattern, min, max and others
- # error class
- .has-danger{}
-
- # set errorMessage | optional - if not informed will show default message
- Ex: <input type="number" min="5" max="20" errorMessage="Preencha corretamente" required />
vue.js表单验证
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。