ChatLoading.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <script setup>
  2. const props = defineProps({
  3. loading: {
  4. type: Boolean,
  5. default: false
  6. },
  7. delayLoading: {
  8. type: Boolean,
  9. default: false
  10. },
  11. })
  12. </script>
  13. <template>
  14. <view class="chat-answer_loading" v-if="delayLoading">
  15. <view class="loading-circus-wrapper">
  16. <view class="loading-icon">
  17. <view class="loading-circus">
  18. <view class="la-ball-circus la-sm la-dark">
  19. <view class="item"></view>
  20. <view class="item"></view>
  21. <view class="item"></view>
  22. <view class="item"></view>
  23. <view class="item"></view>
  24. </view>
  25. </view>
  26. </view>
  27. <text class="loading-text">
  28. <slot></slot>
  29. </text>
  30. </view>
  31. </view>
  32. </template>
  33. <style lang="scss" scoped>
  34. .loading-circus-wrapper {
  35. display: flex;
  36. align-items: center;
  37. .loading-icon {
  38. display: flex;
  39. align-items: center;
  40. justify-content: center;
  41. width: 68rpx;
  42. height: 68rpx;
  43. border: 1px solid #A8D3F1;
  44. border-radius: 50%;
  45. }
  46. .loading-text {
  47. padding: 0 20rpx;
  48. font-size: 28rpx;
  49. font-weight: bold;
  50. color: #666;
  51. }
  52. }
  53. .la-ball-circus,
  54. .la-ball-circus>.item {
  55. position: relative;
  56. -webkit-box-sizing: border-box;
  57. -moz-box-sizing: border-box;
  58. box-sizing: border-box;
  59. }
  60. .la-ball-circus {
  61. display: block;
  62. font-size: 0;
  63. color: #fff;
  64. }
  65. .la-ball-circus.la-dark {
  66. color: #333;
  67. }
  68. .la-ball-circus>.item {
  69. display: inline-block;
  70. float: none;
  71. background-color: #007aff;
  72. border: 0 solid currentColor;
  73. }
  74. .la-ball-circus {
  75. width: 16px;
  76. height: 16px;
  77. }
  78. .la-ball-circus>.item {
  79. position: absolute;
  80. top: 0;
  81. left: -100%;
  82. display: block;
  83. width: 16px;
  84. width: 100%;
  85. height: 16px;
  86. height: 100%;
  87. border-radius: 100%;
  88. opacity: .5;
  89. -webkit-animation: ball-circus-position 2.5s infinite cubic-bezier(.25, 0, .75, 1), ball-circus-size 2.5s infinite cubic-bezier(.25, 0, .75, 1);
  90. -moz-animation: ball-circus-position 2.5s infinite cubic-bezier(.25, 0, .75, 1), ball-circus-size 2.5s infinite cubic-bezier(.25, 0, .75, 1);
  91. -o-animation: ball-circus-position 2.5s infinite cubic-bezier(.25, 0, .75, 1), ball-circus-size 2.5s infinite cubic-bezier(.25, 0, .75, 1);
  92. animation: ball-circus-position 2.5s infinite cubic-bezier(.25, 0, .75, 1), ball-circus-size 2.5s infinite cubic-bezier(.25, 0, .75, 1);
  93. }
  94. .la-ball-circus>.item:nth-child(1) {
  95. -webkit-animation-delay: 0s, -.5s;
  96. -moz-animation-delay: 0s, -.5s;
  97. -o-animation-delay: 0s, -.5s;
  98. animation-delay: 0s, -.5s;
  99. }
  100. .la-ball-circus>.item:nth-child(2) {
  101. -webkit-animation-delay: -.5s, -1s;
  102. -moz-animation-delay: -.5s, -1s;
  103. -o-animation-delay: -.5s, -1s;
  104. animation-delay: -.5s, -1s;
  105. }
  106. .la-ball-circus>.item:nth-child(3) {
  107. -webkit-animation-delay: -1s, -1.5s;
  108. -moz-animation-delay: -1s, -1.5s;
  109. -o-animation-delay: -1s, -1.5s;
  110. animation-delay: -1s, -1.5s;
  111. }
  112. .la-ball-circus>.item:nth-child(4) {
  113. -webkit-animation-delay: -1.5s, -2s;
  114. -moz-animation-delay: -1.5s, -2s;
  115. -o-animation-delay: -1.5s, -2s;
  116. animation-delay: -1.5s, -2s;
  117. }
  118. .la-ball-circus>.item:nth-child(5) {
  119. -webkit-animation-delay: -2s, -2.5s;
  120. -moz-animation-delay: -2s, -2.5s;
  121. -o-animation-delay: -2s, -2.5s;
  122. animation-delay: -2s, -2.5s;
  123. }
  124. .la-ball-circus.la-sm {
  125. width: 8px;
  126. height: 8px;
  127. }
  128. .la-ball-circus.la-sm>.item {
  129. width: 8px;
  130. height: 8px;
  131. }
  132. .la-ball-circus.la-2x {
  133. width: 32px;
  134. height: 32px;
  135. }
  136. .la-ball-circus.la-2x>.item {
  137. width: 32px;
  138. height: 32px;
  139. }
  140. .la-ball-circus.la-3x {
  141. width: 48px;
  142. height: 48px;
  143. }
  144. .la-ball-circus.la-3x>.item {
  145. width: 48px;
  146. height: 48px;
  147. }
  148. /*
  149. * Animations
  150. */
  151. @-webkit-keyframes ball-circus-position {
  152. 50% {
  153. left: 100%;
  154. }
  155. }
  156. @-moz-keyframes ball-circus-position {
  157. 50% {
  158. left: 100%;
  159. }
  160. }
  161. @-o-keyframes ball-circus-position {
  162. 50% {
  163. left: 100%;
  164. }
  165. }
  166. @keyframes ball-circus-position {
  167. 50% {
  168. left: 100%;
  169. }
  170. }
  171. @-webkit-keyframes ball-circus-size {
  172. 50% {
  173. -webkit-transform: scale(.3, .3);
  174. transform: scale(.3, .3);
  175. }
  176. }
  177. @-moz-keyframes ball-circus-size {
  178. 50% {
  179. -moz-transform: scale(.3, .3);
  180. transform: scale(.3, .3);
  181. }
  182. }
  183. @-o-keyframes ball-circus-size {
  184. 50% {
  185. -o-transform: scale(.3, .3);
  186. transform: scale(.3, .3);
  187. }
  188. }
  189. @keyframes ball-circus-size {
  190. 50% {
  191. -webkit-transform: scale(.3, .3);
  192. -moz-transform: scale(.3, .3);
  193. -o-transform: scale(.3, .3);
  194. transform: scale(.3, .3);
  195. }
  196. }
  197. </style>