1.0.2 • Published 3 years ago

vue-juicy-avatar v1.0.2

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

Vue Juicy Avatar Uploader

This component that gives you opportunity to select/crop/upload user avatar

Documentation / Examples

NPM

WARNING: This component is in beta test stage.

npm.io

Install

npm install --save vue-juicy-avatar
yarn add vue-juicy-avatar

Usage

import Vue from 'vue'
import juicyAvatar from 'vue-juicy-avatar'

new Vue({
  el: '#app',
  data: {

  },
  methods: {
    imageChange({file, base64, crop}) {
      console.log('Image change', file, base64, crop)
    },
    uploadSuccess(response) {
      console.log('Response from server', response)
    },
    errorUpload(error) {
      console.log('Upload error', error)
    },
    validationError() {
      console.log('Display error about validation error')
    }
  },
  components: {
    juicyAvatar
  }
})

ID "juicyAvatar" required, component don't loaded without him

<div id="app">
  <juicy-avatar
    id="juicyAvatar"
    v-on:juicy-avatar-image-changes="imageChange"
    v-on:juicy-avatar-success-uploaded="uploadSuccess"
    v-on:juicy-avatar-error-uploaded="errorUpload"
    v-on:juicy-avatar-validation-error="validationError"
   />
</div>

Props

PropTypeDescriptionRequired
uploadUrlStringUrl for upload your imageNo
uploadParamNameStringThe name of the file param that gets transferred No
uploadCropParamNameStringThe name of the crop param that gets transferredNo
uploadAdditionalParamsObjectCan be an object of additional parameters to transfer to the serverNo
uploadHeadersObjectAn optional object to send additional headers to the serverNo
uploadFileBooleanFlag for enable/disable upload video after savingNo
avatarStringUrl existing user avatarNo
modalBtnSaveTextStringText for save buttonNo
modalDescriptionLabelStringText for descriptionNo
modalUploadBtnTextStringText for upload buttonNo
modalUploadImageLabelStringText for label a little higher upload buttonNo
modalTitleLabelStringText for title modal windowNo
showAddPhotoLabelBooleanFlag for display text "Add Photo"No
addPhotoLabelStringText for link "Add Photo"No

Events

EventDescriptionReturn
v-on:juicy-avatar-modal-showGets called when modal openvoid
v-on:juicy-avatar-modal-closeGets called when modal closevoid
v-on:juicy-avatar-error-uploadedGets called at uploading error.error object
v-on:juicy-avatar-success-uploadedGets called at uploading success.response from server
v-on:juicy-avatar-validation-errorGets called at validation errorvoid

License

The source code of this library is licensed under MIT, the documentation and photos are belong to their respective owners.