0.1.9 • Published 1 year ago

vue-cup-avatar v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

VUE-CUP-AVATAR

A vue-cup-avatar component, stands for Vue crop - upload avatar.

It's a Vue component for crop and, forwards the final blob when the user finishes the crop to your function. Based on the website repo seems nice: https://github.com/innocenzi/avatar If you use tailwind/windicss it has support for dark mode. (AKA class="dark") Also, it exposes some ID's if you want to override some styles. (vue-cup-avatar(whole component), va-from (upload from), va-toolbar (crop toolbar with buttons/commands))

The component will open the cropper in full page mode modal.

Simple use (demo in example folder )

yarn add vue-cup-avatar

<script setup lang="ts">
import { VACropper } from 'vue-cup-avatar'
import 'vue-cup-avatar/dist/style.css'

const yourUploadFunction = (data: Blob) => {
 console.log(data)
}

</script>

<template>
 <VACropper avatar="./logo.svg" @cropped="yourUploadFunction" />
</template>

Props

 {
 // avatar image to show as avatar before user crop/upload
 avatar: {
  default: '',
  type: String,
 },
 // size in rem of that avatar
 avatarSize: {
  default: 6,
  type: Number,
 },
 // avatar margin
 avatarMarginBottom: {
  default: 0.8,
  type: Number,
 },
  // avatar margin
 avatarMarginTop: {
  default: 0.8,
  type: Number,
 },
// Don't show the avatar ( just the form)
 noAvatar: {
  default: false,
  type: Boolean,
 },
  // show or not upload from url, default false, will only show upload from file
 showLoadFromUrl: {
  default: false,
  type: Boolean,
 },
}

Events

 cropped: (data: Blob) => unknown

Screenshots

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago