Added first basic form elements
This commit is contained in:
parent
1400f94b2f
commit
4a0351f80c
6 changed files with 197 additions and 9 deletions
50
src/components/pluginComponents/formComponents/JsonForm.vue
Normal file
50
src/components/pluginComponents/formComponents/JsonForm.vue
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue