Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created August 18, 2019 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/d83e4f8053260bc8c81c60e8f1d9b0cc to your computer and use it in GitHub Desktop.
Save uno-de-piera/d83e4f8053260bc8c81c60e8f1d9b0cc to your computer and use it in GitHub Desktop.
<template>
<form>
<v-layout row wrap>
<v-flex xs12 mt-3>
<v-image-input
v-model="image"
:image-quality="0.85"
clearable
image-format="png"
:full-width="true"
minScaling="contain"
:image-width="520"
></v-image-input>
</v-flex>
</v-layout>
<v-layout row wrap justify-end>
<v-flex xs12 lg3 md4 shrink pl-1 pr-1>
<v-btn
:text="$t('uploadFile')"
icon="save"
@click="submit"
/>
</v-flex>
</v-layout>
</form>
</template>
<script>
import VImageInput from "vuetify-image-input";
import S3Utils from "@/classes/S3Utils";
export default {
name: "UploadForm",
components: {
VImageInput
},
data() {
return {
image: null
};
},
methods: {
async submit() {
this.$v.$touch();
if (this.$v.$anyError) return;
await S3Utils.uploadImage(this.image, "photos");
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment