Skip to content

Commit 892469e

Browse files
committed
added "options" to VFG install function, appending custom "validators" to the validators object that are passed into `Vue.use(VueFormGenerator, { validators: { key: (value, field, model) => {} })
1 parent a484031 commit 892469e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ const schema = require("./utils/schema.js");
33
const validators = require("./utils/validators.js").default;
44
const fieldComponents = require("./utils/fieldsLoader").default;
55
const abstractField = require("./fields/abstractField").default;
6-
const install = (Vue) => {
6+
const install = (Vue, options) => {
77
Vue.component("VueFormGenerator", module.exports.component);
8+
if(options && options.validators) {
9+
for(let key in options.validators) {
10+
validators[key] = options.validators[key];
11+
}
12+
}
813
};
914

1015
module.exports = {

0 commit comments

Comments
 (0)