Skip to content

Commit

Permalink
support custom fields & example #62
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Sep 2, 2016
1 parent bccc910 commit e61824a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dev/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions dev/fieldAwesome.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template lang="jade">
input.form-control(type="text", v-model="value", :maxlength="schema.max", :readonly="schema.readonly", :disabled="disabled", :placeholder="schema.placeholder")
</template>

<script>
import VueFormGenerator from "../src";
console.log(VueFormGenerator);
export default {
mixins: [ VueFormGenerator.abstractField ]
};
</script>

<style lang="sass" scoped>
input {
background-color: lighten(blue, 40%) !important;
font-weight: bold;
}
</style>
4 changes: 4 additions & 0 deletions dev/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e61824a

Please sign in to comment.