<template>
  <div class="pageLoad">
    <div class="relativePos">
      <div class="txtBox">
        <div class="relativePos">
          <p>درحال بارگزاری</p>
          <div class="anim"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false
    }
  },
  methods: {
    start() {
      this.loading = true
    },
    finish() {
      this.loading = false
    }
  },
  watch: {
    loading(newVal, oldVal) {
      if (newVal) {
        this.$gsap.timeline()
            .fromTo($('.pageLoad'), {autoAlpha: 0}, {autoAlpha: 1, duration: 0})
      } else {
        this.$gsap.timeline()
            .fromTo($('.pageLoad'), {autoAlpha: 1}, {autoAlpha: 0, duration: 0.1})
      }
    }
  }
}
</script>
