Added first basic form elements

This commit is contained in:
Joel Collins 2019-06-13 17:55:33 +01:00
parent 1400f94b2f
commit 4a0351f80c
6 changed files with 197 additions and 9 deletions

View file

@ -0,0 +1,50 @@
<template>
<div>
<component v-for="(field, index) in schema"
:key="index"
:is="field.fieldType"
v-model="formData[field.name]"
v-bind="field">
</component>
</div>
</template>
<script>
import numberInput from "./fieldComponents/numberInput";
import selectList from "./fieldComponents/selectList";
import textInput from "./fieldComponents/textInput";
import htmlBlock from "./fieldComponents/htmlBlock";
export default {
name: 'JsonForm',
components: {
numberInput,
selectList,
textInput,
htmlBlock
},
props: {
'schema': {
type: Array,
required: true
}
},
data: function () {
return {
formData: {}
}
},
created: function () {
// `this` points to the vm instance
console.log(this.schema)
}
}
</script>
<style scoped></style>