Skip to content

Commit

Permalink
added "options" to VFG install function, appending custom "validators…
Browse files Browse the repository at this point in the history
…" to the validators object that are passed into `Vue.use(VueFormGenerator, { validators: { key: (value, field, model) => {} })
  • Loading branch information
zoul0813 committed Dec 10, 2018
1 parent a484031 commit 892469e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ const schema = require("./utils/schema.js");
const validators = require("./utils/validators.js").default;
const fieldComponents = require("./utils/fieldsLoader").default;
const abstractField = require("./fields/abstractField").default;
const install = (Vue) => {
const install = (Vue, options) => {
Vue.component("VueFormGenerator", module.exports.component);
if(options && options.validators) {
for(let key in options.validators) {
validators[key] = options.validators[key];
}
}
};

module.exports = {
Expand Down

0 comments on commit 892469e

Please sign in to comment.