From 80f1ff56ee0f7e839b7a37f2e36922674ce4ec90 Mon Sep 17 00:00:00 2001 From: MarcZierle <online@marczierle.com> Date: Fri, 21 Jan 2022 21:55:32 +0100 Subject: [PATCH] add spinner to upload photo button --- src/views/CameraCapture.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/CameraCapture.vue b/src/views/CameraCapture.vue index abac1d8..1ad0711 100644 --- a/src/views/CameraCapture.vue +++ b/src/views/CameraCapture.vue @@ -72,7 +72,7 @@ <template #footer> <n-space justify-content="end"> <n-button size="large" @click="showPhotoTakenModal = false; isPhotoTaken = false">Back</n-button> - <n-button type="primary" size="large" @click="uploadPhoto">Upload</n-button> + <n-button type="primary" size="large" @click="uploadPhoto" :loading="isUploading">Upload</n-button> </n-space> </template> </n-modal> @@ -125,6 +125,7 @@ export default { }, showPhotoTakenModal: false, + isUploading: false, } }, beforeMount() { @@ -229,6 +230,7 @@ export default { this.showPhotoTakenModal = true }, uploadPhoto() { + this.isUploading = true const dataURLtoFile = (dataurl, filename) => { const arr = dataurl.split(',') const mime = arr[0].match(/:(.*?);/)[1] @@ -248,6 +250,7 @@ export default { this.message.success('Done!') this.isPhotoTaken = false this.showPhotoTakenModal = false + this.isUploading = false }).catch((error) => { this.message.error('There was an error uploading the photo: ' + error) })