loading.vue 869 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="loading-box" :style="loadingStyle">
  3. <view class="rotate iconfont icon-loading" :style="icontStyle"></view>
  4. <slot></slot>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {}
  11. },
  12. props: {
  13. size: {
  14. type: Number,
  15. default: 100
  16. },
  17. mask: {
  18. type: Boolean,
  19. default: true
  20. }
  21. },
  22. computed: {
  23. icontStyle() {
  24. return `font-size:${this.size}rpx`;
  25. },
  26. loadingStyle() {
  27. return this.mask ? "background: rgba(0, 0, 0, 0.3);" : "";
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .loading-box {
  34. width: 100%;
  35. height: 100%;
  36. position: absolute;
  37. left: 0;
  38. top: 0;
  39. z-index: 10000;
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. }
  44. .rotate {
  45. animation: rotate 2s ease-in-out infinite;
  46. }
  47. @keyframes rotate {
  48. from {
  49. transform: rotate(0deg)
  50. }
  51. to {
  52. transform: rotate(360deg)
  53. }
  54. }
  55. </style>