-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for schema.legend & field id prefixes
* Add support for an optional legend for each schema/fieldset. Expects the schema to look something like this: ``` schema: { legend: "Contact Details", fields: [ { type: "input", inputType: "text", label: "Name", model: "name" }, ... ``` * Add support for field id prefixes, at the form level. So you can add a `fieldIdPrefix: 'prefix_here_'` to your `formOptions` and this will be prepended to _all_ field id's.
- Loading branch information
Duncan Lock
committed
May 25, 2017
1 parent
5552079
commit a6165c8
Showing
6 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template lang="html"> | ||
<form> | ||
<vue-form-generator :schema="section1" :model="model" :options="formOptions"></vue-form-generator> | ||
<vue-form-generator :schema="section2" :model="model" :options="formOptions"></vue-form-generator> | ||
</form> | ||
</template> | ||
|
||
<script> | ||
import Vue from "vue"; | ||
export default { | ||
data () { | ||
return { | ||
model: { | ||
name: 'Brian Blessed', | ||
email: "[email protected]", | ||
pref_1: 'blah' | ||
}, | ||
section1: { | ||
legend: "Contact Details", | ||
fields: [ | ||
{ | ||
type: "input", | ||
inputType: "text", | ||
label: "Name", | ||
model: "name" | ||
}, | ||
{ | ||
type: "input", | ||
inputType: "email", | ||
label: "Email", | ||
model: "email" | ||
} | ||
] | ||
}, | ||
section2: { | ||
fields: [ | ||
{ | ||
type: "input", | ||
inputType: "text", | ||
label: "Pref 1", | ||
model: "pref_1" | ||
} | ||
] | ||
}, | ||
formOptions: { | ||
fieldIdPrefix: 'frm1_' | ||
} | ||
} | ||
}, | ||
created() { | ||
window.app = this; | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>vue-form-generator multiple forms demo</title> | ||
</head> | ||
<body> | ||
<div class="container-fluid"></div> | ||
<div id="app"></div> | ||
<script src="/mforms.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Vue from "vue"; | ||
import VueFormGenerator from "../../src"; | ||
Vue.use(VueFormGenerator); | ||
|
||
import App from './app.vue'; | ||
|
||
new Vue({ | ||
...App | ||
}).$mount('#app'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters