Upload async component for Vue and compatible with Vuetify.
npm install @tityus/vue-uploader
import VueUploader from '@tityus/vue-uploader';
<script>
var app = new Vue({
el: '#app',
data: {},
component: {
VueUploader
}
})
</script>
<vue-uploader></vue-uploader>
accept
: [String, default : '']
: Specifies what file types the user can pick.
target
: [String, default : '']
: Target of your API/Backend
selected
: [Boolean, default: false]
: Show selected file
vuetify
: [Boolean, default: false]
: Transform to vuetify button.
dark
, flat
, fab
, large
, outline
: [Boolean, default: false]
: See more on Vuetify.
icon
: [String, default: '']
: Add icon to button.
You can get response from your API.
<vue-uploader @uploadResponse="getResponse"></vue-uploader>
You can get file selected
<vue-uploader @uploadFile="getFile"></vue-uploader>
<script>
methods: {
getResponse(value) {
console.log(value);
}
}
</script>
<vue-uploader
accept="image/*"
vuetify
target="/api/upload"
@uploadResponse="getResponse()" // get data from component
@uploadFile="getFile()"
vuetify
outline
color="indigo"
large
icon="cloud_upload" // Material Icon
>
Select a file // You can change slot's message
</vue-uploader>
For contribute, you can help by submitting an issue or a pull request.