This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 129
Form Builder Template Implementation
Phat Tran edited this page Sep 20, 2018
·
2 revisions
1/ Import as global component
import FormBuilder from 'v-form-builder';
Vue.component('FormBuilder', FormBuilder);
2/ Import as single component
import FormBuilder from 'v-form-builder';
export default {
components: {FormBuilder}
...
}
<template>
<div>
// form builder template
<form-builder type="template" v-model="formConfigData"></form-builder>
</div>
</template>
You can use v-model in Form Builder Template, it'll return to you the form configuration data that you're configurated (object) and also render the old configuration and let you edit/update that old configuration.
Go to your http://<your_vue_url_page>/ and test it :D The Form Builder Template will appear with all functionals
In order to use the API, you need to set a ref:
<form-builder type="template" v-model="formConfigData" ref="FormBuilder"></form-builder>
You can use the v-model and this way too:
this.$refs.FormBuilder.getValue();
An object of your configurated form will be return.
You can use the v-model and this way too:
this.$refs.FormBuilder.setValue(formDataObject);
For the best practice, I suggest you should use the v-model (2-way binding) :D
Copyright © by Seth Phat aka Phat Tran Minh - http://sethphat.com
- Home