Loading.vue 1.0 KB

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