Loading.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. >
  9. <!-- :style="currentScene.icon && { backgroundImage: `url(${currentScene.icon})` }" -->
  10. <div class="ui-waiting">
  11. <div class="icon">
  12. <img :src="require('@/assets/images/loading.png')" alt="" />
  13. </div>
  14. <div class="txt">{{$t('common.loading')}}</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 currentScene = computed(() => store.getters["scene/currentScene"]);
  36. useApp().then((app) => {
  37. app.Scene.on("ready", () => {
  38. if (show.value) {
  39. show.value = false;
  40. }
  41. });
  42. });
  43. </script>
  44. <style lang="scss" scoped>
  45. .scene-loading {
  46. display: table;
  47. table-layout: fixed;
  48. height: 100%;
  49. width: 100%;
  50. z-index: 11;
  51. background-repeat: no-repeat;
  52. background-position: 50%;
  53. background-size: cover;
  54. .ui-waiting {
  55. color: #fff;
  56. text-align: center;
  57. display: table-cell;
  58. text-align: center;
  59. vertical-align: middle;
  60. width: 100%;
  61. height: 100%;
  62. .icon {
  63. width: 60px;
  64. height: 60px;
  65. position: relative;
  66. overflow: hidden;
  67. margin: 10px auto;
  68. > img {
  69. height: 60px;
  70. position: absolute;
  71. left: 0;
  72. top: 0;
  73. animation: loading 1s steps(15) infinite;
  74. }
  75. }
  76. .txt {
  77. font-size: 14px;
  78. }
  79. .spinner {
  80. width: 100%;
  81. text-align: center;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. margin-top: 5px;
  86. > div {
  87. width: 5px;
  88. height: 5px;
  89. background-color: #fff;
  90. margin: 5px;
  91. border-radius: 100%;
  92. display: inline-block;
  93. animation: bouncedelay 1.4s infinite ease-in-out;
  94. animation-fill-mode: both;
  95. }
  96. .bounce1 {
  97. animation-delay: -0.32s;
  98. }
  99. .bounce2 {
  100. animation-delay: -0.16s;
  101. }
  102. }
  103. }
  104. }
  105. @keyframes loading {
  106. 100% {
  107. left: -900px;
  108. }
  109. }
  110. </style>