A Vue.js component for showing a Vuetify input/button for file uploading.
npm install vuetify-upload-buttonjs
npm i vuetify-upload-button
`
$3
Include the script file, then install the component with Vue.use(UploadButton); e.g.:
`html
`
$3
`js
import UploadButton from 'vuetify-upload-button';
export default {
components: {
'upload-btn': UploadButton
}
}
`
$3
In order for the ripple directive to work properly, you must import the Ripple directive.
`js
// plugins/vuetify.js
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
import { Ripple } from 'vuetify/lib/directives'
Vue.use(Vuetify, {
// other stuff
directives: {
Ripple
}
})
`
Usage
Once installed, it can be used in a template as simply as:
Simple Upload button
`html
`
Upon file change, the Upload Button component emit a file-update event with the file or files as the argument, see the following example:
`html
@file-update="update"
>
`
Button with icon. The 'icon' slot defaults to the right:
`html
title="Button With Icon"
>
add
`
Button with left icon:
`html
title="Button With Icon"
>
add
`
Button as icon
`html
add
`
You can clear the file input using a ref
`html
``