JSPM

  • Created
  • Published
  • Downloads 4386
  • Score
    100M100P100Q117062F
  • License MIT

Vue.js component to handle CSV uploads with field mapping.

Package Exports

  • vue-csv-import

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-csv-import) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vue.js component to handle CSV uploads with field mapping.

Latest Version on NPM Software License CircleCI

Demo

Demo

Go to the "docs" folder for a working example.

Installation

You can install the package via yarn:

yarn add vue-csv-import

or npm:

npm install vue-csv-import --save

Usage

Import component:

import { VueCsvImport } from '../src';

new Vue({
    components: { VueCsvImport },

    el: '#app',
});

Include in template:

<vue-csv-import url="/url/to/post" :map-fields="['array', 'of', 'field', 'names']"></vue-csv-import>

or with labels:

<vue-csv-import url="/url/to/post" :map-fields="[field1: 'Label 1', field2: 'Label 2']"></vue-csv-import>

Options:

Option Default Description
mapFields N/A (required) These are the field names that the CSV will be mapped to
url null If present, the component will post the mapped values to this url. Otherwise, the component will only emit the value to be used as a normal input
callback null The callback to be called on successful upload. (url required)
catch null The function to be called on an error in posting (url required)
finally null The function to be called no matter what on posting (url required)
tableClass "table" The class to be added to table element
checkboxClass "form-check-input" The class to be added to the checkbox
buttonClass "btn btn-default" The class to be added to buttons
inputClass "form-control-file" The class to be added to the file input
submitBtnText "Submit" The value of the final submit button
loadBtnText "Submit" The value of the initial load file button

Testing

yarn test

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please contact John Gile.

License

The MIT License (MIT). Please see License File for more information.

Credits