loading.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view>
  3. <view v-if="isShowLoading" class="iconfont loading">&#xe84b;</view>
  4. <view class="loading-text" v-if="text != ''">
  5. <view>{{text}}<text class="dotting"></text></view>
  6. </view>
  7. <view
  8. v-if="layer"
  9. class="layer-box"
  10. :style="'background-color:'+color"
  11. ></view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: "loading",
  17. props:{
  18. text:{
  19. type: String,
  20. default: ""
  21. },
  22. isShowLoading: {
  23. type:Boolean,
  24. default:true
  25. },
  26. layer:{
  27. type:Boolean,
  28. default:false
  29. },
  30. color:{
  31. type:String,
  32. default: "rgba(255,255,255,0.1)"
  33. }
  34. },
  35. mounted() {
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. :root .dotting { margin-right: 8px; }
  41. .loading {
  42. font-size: 50rpx;
  43. position: fixed;
  44. left: 47%;
  45. top: 40%;
  46. z-index: 100002;
  47. background-size: 100%;
  48. transform: translateX(-47%);
  49. transform: translateY(-40%);
  50. animation: aaa-spin 2s infinite linear;
  51. display: inline-block;
  52. }
  53. .loading-text {
  54. width: 100%;
  55. font-size: 29rpx;
  56. text-align: center;
  57. position: fixed;
  58. top: 47%;
  59. color: #333;
  60. z-index: 100002;
  61. background-size: 100%;
  62. transform: translateY(-40%);
  63. view {
  64. width: 80%;
  65. margin: 0 auto;
  66. .dotting {
  67. display: inline-block; min-width: 2px; min-height: 2px;
  68. animation: dot 4s infinite step-start both;
  69. font-size: 29rpx;
  70. }
  71. }
  72. }
  73. .layer-box{
  74. width: 100%;
  75. height: 100%;
  76. position: fixed;
  77. top: 0;
  78. left: 0;
  79. background-color: rgba(255,255,255,0.1);
  80. z-index: 100001;
  81. }
  82. @keyframes aaa-spin {
  83. 0% {
  84. transform: rotate(0deg)
  85. }
  86. 100% {
  87. transform: rotate(359deg)
  88. }
  89. }
  90. @keyframes dot {
  91. 25% { box-shadow: none; }
  92. 50% { box-shadow: 2px 0 #666; }
  93. 75% { box-shadow: 2px 0 #666, 6px 0 #666; }
  94. }
  95. </style>