vue-ajax-form
A Vue2 component for creating AJAX forms.
Installation
via npm
npm install vue-ajax-form --save
via yarn
yarn add vue-ajax-form
Vue.component'AjaxForm', AjaxForm
Or use a CDN
Usage
Use it like an HTML form.
Submit
Props
Property | Type | Default | Description | Required? |
---|---|---|---|---|
axios | AxiosInstance | The static Axios instance | The axios instance to use for the requests. | No |
action | string | # | The form action | No |
method | string | POST | The form method | No |
data | Object | {} | Additional data to merge into the request | No |
Events
Event | Description | $event |
---|---|---|
before | Emitted before the requests submits. | { axios, action, method, data } |
success | Emitted after a 2xx response | Axios response object |
error | Emitted after a 4xx response | Axios response object |
complete | Emitted after the success or error event |