Chatwoot/app/javascript/dashboard/components/widgets/forms/AvatarUploader.vue
Pranav Raj S 884a1c5971
Chore: Add an option to upload a business logo to inbox (#905)
Chore: Add an option to upload a business logo to inbox
2020-05-31 16:16:22 +05:30

39 lines
650 B
Vue

<template>
<label>
<span v-if="label">{{ label }}</span>
<woot-thumbnail v-if="src" size="80px" :src="src" />
<input
id="file"
ref="file"
type="file"
accept="image/*"
@change="handleImageUpload"
/>
<slot></slot>
</label>
</template>
<script>
export default {
props: {
label: {
type: String,
default: '',
},
src: {
type: String,
default: '',
},
},
methods: {
handleImageUpload(event) {
const [file] = event.target.files;
this.$emit('change', {
file,
url: URL.createObjectURL(file),
});
},
},
};
</script>