1.0.2 • Published 3 years ago

vue-file64 v1.0.2

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

Vue-File64

A simple way to convert files to base64 strings, with multiple and extension based filter.

Installation

npm i vue-file64

Importing Globally

You can import this package as usual, here as an example the package is imported globally.

import FileDialog from 'vue-file64; Vue.component('file-dialog-64', FileDialog);

Usage

<file-dialog-64
  :isInvalid="form.errors.errors.hasOwnProperty('image')"
  :accept="''"
  @output="
    (file) => {
      this.form.image = file;
    }
  "
  :label="'Upload your files'"
>
<p slot="errorMessage" class="invalid-feedback d-block"> Image is required </p>
</file-dialog-64>

Props

Prop NameTypeDescription
labelStringUsed as common html label
placeholderStringCan be used to replace the default placeholder "Choose files", however this will be overridden when files are selected
acceptStringSame as HTML accept, can be used to filter extensions, example :accept="'.jpg, .png'"
multipleBooleanEnable ability to select multiple files
isInvalidBooleanActivates the invalid class if set to true, highlights in red.

Events

EventDescription
outputReturns the base64 strings of the uploaded files.
filecountReturns the number of uploaded

Slots

Slot NameDescription
errorMessageCan be used to set your own error message.
onCompleteMake use to show something when the upload is complete. Such as previewing the files.

\ \ Feel free to contribute to this project, thanks