Getting Started
Let's integrate the UseCSV Importer plugin with your Vue.js app.
Make sure you configured your importer before starting.
Install
Using NPM
npm install @usecsv/vuejs
Using YARN
yarn add @usecsv/vuejs
Add the Importer
Adding the UseCSVButton
component to your frontend will render a button that triggers the import modal when clicked.
Additional metadata can be passed in the user
prop, and this will be passed back to your app in the JSON webhook when data is imported. It's a good idea to include a userId
or similar identifying data, so you can correctly identfiy and import the data into your app. Check more details about Options.
importerKey: string
Which can be found in the admin panel.user: json object
Contains details of the importing user, so that they can be identified easily.
Code example with default button
Import plugin:
import UsecsvButton from "@usecsv/vuejs"
Vue.use(UsecsvButton);
use in your app
<template>
<usecsv-button importerKey="your-importer-key">
Import Data
</usecsv-button>
</template>

Code example with custom button
use scoped slots to render you CustomButton component.
the component has to have an openModal
prop which is passed down form usecsv-button
usage:
<template>
<usecsv-button importerKey="your-importer-key" v-slot="slotProps">
<custom-button :openModal="slotProps.openModal"/>
</usecsv-button>
</template>
CustomButton component:
<template>
<button class="btn" @click="openModal">
Import Data
</button>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
name: 'btn',
props: ["openModal"]
});
</script>
<style scoped>
.btn {
width: 170px;
height: 70px;
color: #fff;
background-color: #027ad6;
box-shadow: 0 32px 64px rgba(0,0,0,0.07);
font: 700 24px sans-serif;
text-align: center;
border: none;
border-radius: 3px;
}
</style>

Now your users can import data from within your app, the final step is to setup a webhook in your backend to receive imports. Let's goto the Webhook docs.