async-validator
async-validator copied to clipboard
validate form asynchronous
[我想校验`arr`中的`name`和`age`规则怎么写,[#108](https://github.com/yiminghe/async-validator/issues/108)这个看了半天没看明白 ```javascript formData: { name: '', arr: [ { name: '', age: '' } ] } ```
非必填输入框没有值时,校验失败,提示 is not a number,应该校验通过 ` `
chunk-vendor 中会将项目中的环境变量全部引入到代码中,如下:VUE_APP_DEFIND_NAME 为自定义的环境变量。 ``` javascript "undefined" !== typeof t && Object({ NODE_ENV: "production", VUE_APP_DEFIND_NAME: "THIS IS DEFINED NAME", BASE_URL: "/" }); ```
想这种好像没起作用? ```json "rules": { "type": "object", "required": true, "defaultField": {}, "pattern": "^[A-Za-z0-9-]+$", "message": "规则名称长度小于100,必须只包含字母、数字、中划线" } ```
```js const source = { date: 'qwertyu', // or ' ' | '12345' | anything }; const rules = { date: { required: true, type: 'date', } }; new Schema(rules).validate(source,...
Can we validate a field based on the result of another field... Make a field required only if another field is required.
```this.changecakeForm.price = 26``` ``` ``` ``` changecakeForm: { price: null } ``` ``` price: [ { required: true, message: '茶点价格不能为空', trigger: 'blur' }, { type: 'number', message: '请输入数字', trigger: 'blur',...
https://codesandbox.io/s/weathered-snowflake-n0d1f?file=/src/App.js rule 设置了 message 后,validator 返回的 Promise.reject message 会被无视掉。用户反馈设置了 required 和 message,自定义的 validator message 就用不了了。