Loading.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template lang="html">
  2. <div class="loading" :class="{'mobile': isMobile}" v-show="loading" id="loading">
  3. <!--<img src="/images/all/loading.gif" alt="">-->
  4. <div class="wrap">
  5. <div class="outer"></div>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. data: () => ({
  12. loading: false
  13. }),
  14. methods: {
  15. start () {
  16. this.loading = true
  17. },
  18. finish () {
  19. this.loading = false
  20. }
  21. }
  22. }
  23. </script>
  24. <style scoped lang="scss">
  25. @keyframes spin {
  26. 0% { transform: rotate(360deg); }
  27. 100% { transform: rotate(0deg); }
  28. }
  29. .wrap { width: 64px; height: 64px; position: absolute;left: 50%;top:50%;margin-left:-32px;margin-top: -32px; }
  30. .outer {
  31. background-repeat: no-repeat;
  32. background-size:100%; position: absolute; width: 100%; height: 100%; background-image: url('/images/mobile/loading.png'); animation: spin 800ms infinite linear; }
  33. .loading {
  34. position: fixed;
  35. top: 0;
  36. left: 0;
  37. right: 0;
  38. width: 100%;
  39. height: 100%;
  40. z-index: 1000;
  41. text-align: center;
  42. &.mobile {
  43. z-index: 100000 !important;
  44. }
  45. }
  46. .loading img {
  47. position: relative;
  48. top: 40%;
  49. }
  50. .loading.in {
  51. display: block !important;
  52. }
  53. </style>