vue-attachment
v0.0.6
Published
An Attachement component for Vue.js
Downloads
45
Readme
vue-attachment
An Attachement component for Vue.js
This component provides an simple and out-of-box experience for file attachments.
Installation
yarn add vue-attachmentor
npm i vue-attachment --saveDemo
There is an simple example on the /demo folder. HERE
Usage
Import Globally:
import Vue from 'vue'
import VueAttachment from 'vue-attachment'
Vue.use(VueAttachment)Import as a Component:
import VueAttachment from 'vue-attachment'
...
{
components: { VueAttachment }
}
...Example
<template>
<form @submit.prevent="submit">
<v-attachment v-model="attachments" endpoint="/upload.php" />
</form>
</template>
<script>
export default {
data() {
return {
attachments: [
'file.pdf',
'image.jpg'
]
}
}
},
methods: {
submit() {
....
}
}
</script>Properties
| Name | Type | Required | Default | Info | | ----------------------- | -------- | -------- | --------------- | --------------------------------------------------------------------------- | | value | Array | False | [] | List of files imported (v-model when binding is important) | | endpoint | String | False | upload.php | Upload Endpoint |
Events
| Name | Params | Info | | ------------ | -------------------------------- | -------------------------------------------------------------------------- | | success | server message | Triggered after sending file with success | | error | server message | Triggered after sending file without success | | removed | filename | Triggered when a file is remove | | input | attachments | Triggered after a change on attachments files |
