vue-json-to-csv is a component of Vue.js 2 to convert or transform and download json in csv format.
How to make use of it:
Installation
npm install --save vue-json-to-csv
Usage
import VueJsonToCsv from 'vue-json-to-csv'
<script src="vue.min.js"></script> <!-- must place this line after vue.js --> <script src="dist/vue-json-to-csv.min.js"></script> <script type="text/javascript"> Vue.use(VueJsonToCsv); </script>
Configuration
Prop | Details |
---|---|
json-data | An array of the objects which contain the data to display (required). Each key will be a different column in the CSV. All the objects should contain the same keys. If an empty array an error will be returned. Example: [ { name: 'Joe', surname: 'Roe' }, { name: 'Joe', surname: 'Doe' }] |
show-labels | Boolean. If false the first row of the CSV will not contain the names of the labels. |
labels | An object of the keys of the labels will be displayed. Use to filter the keys to display and modify their label title. For each key, we provide the title of the key to display. If not defined all the keys will be parsed. Example: { name: { title: 'First name' } } |
csv-title | String. The title of the generated CSV. Default: ‘CSV’ |
separator | String. The separator of the columns. Default: ‘,’ |
@update:error | Will be triggered in case of an empty JSON array, if the labels object has no children or any parsing issue |
@update:success | Will be triggered in case of a successful CSV creation |
json to csv converter for vue, vue-json-to-csv Plugin/Github
See Demo And Download
Official Website(angeliquekom): Click Here
This superior jQuery/javascript plugin is developed by angeliquekom. For extra advanced usage, please go to the official website.