vue-ajax-form

0.3.2 • Public • Published

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
import AjaxForm from 'vue-ajax-form'
 
Vue.component('AjaxForm', AjaxForm)

Or use a CDN

<script src="https://unpkg.com/vue-ajax-form"></script>

Usage

Use it like an HTML form.

<ajax-form action="/users" method="post">
  <input type="email" name="email" placeholder="Email address">
  <input type="password" name="password" placeholder="Password">
  <button type="submit">Submit</button>
</ajax-form>

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.22latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.22
0.3.10
0.3.00
0.2.11
0.2.00
0.1.00

Package Sidebar

Install

npm i vue-ajax-form

Weekly Downloads

1

Version

0.3.2

License

MIT

Unpacked Size

680 kB

Total Files

20

Last publish

Collaborators

  • bono