<template>
	<div v-if="counting > 0" class="file-upload-indicator">
		{{$t('Uploading')}}({{counting}})
		<i class="el-icon-loading"></i>
	</div>
</template>

<script>
	import events from "../../../global-events";

	export default {
		name: "UploadIndicator",
		data() {
			return {
				counting: 0,
			}
		},
		mounted() {
			events.$on('upload-indicator', this.onUploadIndicator);
		},
		destroyed() {
			events.$off('upload-indicator', this.onUploadIndicator);
		},
		methods: {
			onUploadIndicator(show) {
				this.counting += show ? 1 : -1;
			},
		}
	}
</script>

<style scoped>

</style>