Skip to content

Commit f378250

Browse files
committed
Add helper vfjsHelperSchemaHasErrors
1 parent 96a0f64 commit f378250

File tree

1 file changed

+8
-0
lines changed
  • src/vfjs-global-mixin/methods/vfjs-helpers

1 file changed

+8
-0
lines changed

src/vfjs-global-mixin/methods/vfjs-helpers/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ const vfjsHelpers = {
249249

250250
return value;
251251
},
252+
vfjsHelperSchemaHasErrors(schema, model) {
253+
const value = typeof model === 'undefined' ? this.getVfjsModel() : this.getVfjsFieldModel(model);
254+
255+
this.ajv.validate(schema, value);
256+
const oldErrors = this.ajv.errors ? this.ajv.errors : [];
257+
258+
return oldErrors.length === 0;
259+
},
252260
getVfjsFieldsModels(fields, fieldModels = []) {
253261
return fields.reduce((models, { children = [], model }) => {
254262
if (model) {

0 commit comments

Comments
 (0)