From e61824a8f50b766e9223663ae125c9bfdb8f651d Mon Sep 17 00:00:00 2001 From: Icebob Date: Fri, 2 Sep 2016 15:52:03 +0200 Subject: [PATCH] support custom fields & example #62 --- dev/app.vue | 4 ++++ dev/fieldAwesome.vue | 20 ++++++++++++++++++++ dev/schema.js | 4 ++++ src/index.js | 1 + 4 files changed, 29 insertions(+) create mode 100644 dev/fieldAwesome.vue diff --git a/dev/app.vue b/dev/app.vue index 1b1ff605..ff01b560 100644 --- a/dev/app.vue +++ b/dev/app.vue @@ -39,6 +39,10 @@ import { users } from "./data"; import { filters } from "./utils"; + // Test custom field + import FieldAwesome from "./fieldAwesome.vue"; + Vue.component("fieldAwesome", FieldAwesome); + import {each, isFunction, cloneDeep, merge} from 'lodash'; Vue.use(VueFormGenerator); diff --git a/dev/fieldAwesome.vue b/dev/fieldAwesome.vue new file mode 100644 index 00000000..e9dbb536 --- /dev/null +++ b/dev/fieldAwesome.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/dev/schema.js b/dev/schema.js index 3602fb6a..9d963383 100644 --- a/dev/schema.js +++ b/dev/schema.js @@ -179,6 +179,10 @@ module.exports = { label: "E-mail (email field)", model: "email", placeholder: "User's e-mail address" + }, { + type: "awesome", + label: "Awesome (custom field)", + model: "userName" }, { type: "googleAddress", label: "Location (googleAddress)", diff --git a/src/index.js b/src/index.js index 419e8f0d..b2808d62 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ module.exports = { component: require("./formGenerator.vue"), schema: require("./utils/schema.js"), validators: require("./utils/validators.js"), + abstractField: require("./fields/abstractField").default, install(Vue) { Vue.component("VueFormGenerator", module.exports.component);