Loading ​
Loading forms into Vueform Builder.
Once a form's JSON (and its history) are saved into the database, they can be loaded back into Vueform Builder using the .load()
method:
vue
<template>
<div id="app" class="h-screen">
<VueformBuilder
ref="builder$"
/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import axios from 'axios'
onMounted(async () => {
const form = (await axios.get('/url')).data
const builderObject = form.builder // object representing the form
const history = form.history // array containing previous versions of the form
this.$refs.builder$.load(builderObject, history)
})
</script>
In this example, the form's structure (builderObject
) and its history
are fetched from a database via an API request. The .load()
method of the Vueform Builder component is used to load the form and its history into the builder.