<template>
    <div class="j-loading-container"
         v-show="visible">
        <div class="j-loading-spinner-container">
            <div class="j-loading-spinner">
                <div class="j-loading-spinner-loader"></div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        value: {
            default: false
        },
    },
    data() {
        return {
            visible: this.value
        };
    },
    watch: {
        value() {
            if (this.value !== this.visible) {
                this.visible = this.value;
            }
        },
        visible() {
            if (this.value !== this.visible) {
                this.$emit('input', this.visible);
            }
        }
    }
}
</script>