vue-blob-json-csv
Component library to download a JSON or CSV file using Vue.
Demo
Installation
- NPM / Yarn
$ yarn add vue-blob-json-csv# or $ npm i --save vue-blob-json-csv
- Modules
;; Vue
- CDN
Usage
Module
<template> <vue-blob-json-csv @success="handleSuccess" @error="handleError" tag-name="div" file-type="json" file-name="sample" title="Download JSON" :data="data" confirm="Do you want to download it?" ></template>
- Use Slot
<template> <vue-blob-json-csv @success="handleSuccess" @error="handleError" file-type="json" file-name="sample" :data="data" > <h2>Title</h2> <p>csv download</p> </vue-blob-json-csv></template>
CDN
Download JSON
Props
Prop | Data Type | Required | Default | Description |
---|---|---|---|---|
tagName |
String | false |
span |
Element Tag Name |
title |
String | false |
Button title name | |
fileType |
String | true |
csv |
File extension (csv or json ) |
fileName |
String | false |
data |
File name |
data |
Array | true |
Data you want to export | |
fields |
Array | false |
Export only specific keys | |
confirm |
String | false |
Text to display in the dialog |
Events
Event | Description |
---|---|
success |
Event after download is complete |
error |
Error |
Contributing
Welcome to improve vue-blob-json-csv with any issue, pull request or code review.
# Setup $ cd vue-blob-json-csv$ yarn # dev-server $ yarn serve # Build $ yarn build:lib # Unit Testing $ yarn test:unit # Lint $ yarn lint# Lint - fix $ yarn lint --fix
License
MIT