all files / src/components/Loading/ index.vue

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84                                                                                                                                                                       
<template>
  <div class="loading">
    <div class="inner">
      <h1>{{text}}</h1>
      <svg id="load" x="0px" y="0px" viewBox="0 0 150 150">
        <circle id="loading-inner" cx="75" cy="75" r="60"/>
      </svg>
    </div>
  </div>
</template>
 
<script>
export default {
  name: 'loading',
  props: {
    text: {
      type: String,
      default: 'Loading'
    }
  }
}
</script>
 
 
<style lang="scss" scoped>
.loading {
  position: absolute;
  height: 100%;
  width: 100%;
  background: rgba(190, 190, 190, .9);
  z-index: 10;
  .inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    > h1 {
      text-align: center;
      font-size: 2.5em;
      margin-bottom: 1em;
      font-weight: 300;
      color: #fc3;
    }
  }
}
 
#load {
  width: 150px;
  animation: loading 3s linear infinite;
  #loading-inner {
    stroke: {
      dashoffset: 0;
      dasharray: 300;
      width: 10;
      miterlimit: 10;
      linecap: round;
    }
    animation: loading-circle 2s linear infinite;
    stroke: #fc3;
    fill: transparent;
  }
}
 
@keyframes loading {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
 
@keyframes loading-circle {
  0% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: -600;
  }
}
</style>