Loading.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <transition appear name="custom-classes-transition" leave-active-class="animated fadeOut faster">
  3. <div
  4. v-if="show"
  5. class="scene-loading"
  6. :class="{ small: small, thumb: props.thumb }"
  7. @touchmove.prevent
  8. :style="metadata.icon && { backgroundImage: `url(${metadata.icon})` }"
  9. >
  10. <div class="ui-waiting">
  11. <div class="icon">
  12. <img :src="require('@/assets/images/loading.png')" alt="" />
  13. </div>
  14. <div class="txt">加载中</div>
  15. </div>
  16. </div>
  17. </transition>
  18. </template>
  19. <script setup>
  20. import { ref, watch, computed, onMounted, defineProps } from "vue";
  21. import { useStore } from "vuex";
  22. import { useApp } from "@/app";
  23. const props = defineProps({
  24. small: {
  25. type: Boolean,
  26. default: false,
  27. },
  28. thumb: {
  29. type: Boolean,
  30. default: false,
  31. },
  32. });
  33. const store = useStore();
  34. const show = ref(true);
  35. const metadata = computed(() => store.getters['scene/metadata'])
  36. useApp().then((app) => {
  37. app.Scene.on("ready", () => {
  38. show.value = false;
  39. });
  40. });
  41. </script>
  42. <style lang="scss" scoped>
  43. .scene-loading {
  44. display: table;
  45. table-layout: fixed;
  46. height: 100%;
  47. width: 100%;
  48. z-index: 11;
  49. background-repeat: no-repeat;
  50. background-position: 50%;
  51. background-size: cover;
  52. .ui-waiting {
  53. color: #fff;
  54. text-align: center;
  55. display: table-cell;
  56. text-align: center;
  57. vertical-align: middle;
  58. width: 100%;
  59. height: 100%;
  60. .icon {
  61. width: 60px;
  62. height: 60px;
  63. position: relative;
  64. overflow: hidden;
  65. margin: 10px auto;
  66. > img {
  67. height: 60px;
  68. position: absolute;
  69. left: 0;
  70. top: 0;
  71. animation: loading 1s steps(15) infinite;
  72. }
  73. }
  74. .txt {
  75. font-size: 14px;
  76. }
  77. .spinner {
  78. width: 100%;
  79. text-align: center;
  80. display: flex;
  81. justify-content: center;
  82. align-items: center;
  83. margin-top: 5px;
  84. > div {
  85. width: 5px;
  86. height: 5px;
  87. background-color: #fff;
  88. margin: 5px;
  89. border-radius: 100%;
  90. display: inline-block;
  91. animation: bouncedelay 1.4s infinite ease-in-out;
  92. animation-fill-mode: both;
  93. }
  94. .bounce1 {
  95. animation-delay: -0.32s;
  96. }
  97. .bounce2 {
  98. animation-delay: -0.16s;
  99. }
  100. }
  101. }
  102. }
  103. @keyframes loading {
  104. 100% {
  105. left: -900px;
  106. }
  107. }
  108. </style>