loading.vue 813 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <img :src="icon" alt="" class="loading"
  3. :style="{ 'width': `${width}px`, 'height': `${height}px`, 'margin-left': `-${width / 2}px`, 'margin-top': `-${height / 2}px` }" />
  4. </template>
  5. <script setup>
  6. import { defineProps } from "vue";
  7. const props = defineProps({
  8. width: {
  9. type: Number,
  10. default: 40
  11. },
  12. height: {
  13. type: Number,
  14. default: 40
  15. },
  16. icon: {
  17. type: String,
  18. default: require('@/assets/svg/icon-loading-gray2.svg')
  19. }
  20. })
  21. </script>
  22. <style lang="scss" scoped>
  23. .loading {
  24. position: absolute;
  25. top: 50%;
  26. left: 50%;
  27. animation: rotation 1s linear infinite;
  28. }
  29. @keyframes rotation {
  30. from {
  31. -webkit-transform: rotate(0deg);
  32. }
  33. to {
  34. -webkit-transform: rotate(360deg);
  35. }
  36. }
  37. </style>