Skip to content

Commit 862ebd8

Browse files
authored
Merge pull request #560 from zoul0813/feature/545-vue-use-validators
added "options" to VFG install function, appending custom "validators…
2 parents 1ce7045 + 4e81d2d commit 862ebd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ 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+
if ({}.hasOwnProperty.call(options.validators, key)) {
11+
validators[key] = options.validators[key];
12+
}
13+
}
14+
}
815
};
916

1017
module.exports = {

0 commit comments

Comments
 (0)