StartUp.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div class="start-up">
  3. <div class="loading-bar">
  4. <div
  5. class="loading-progress"
  6. :style="{
  7. width: `${progress * 100}%`,
  8. }"
  9. />
  10. <img
  11. src="@/assets/images/icon_shop-active.png"
  12. alt=""
  13. class="cursor"
  14. draggable="false"
  15. :style="{
  16. left: `${progress * 100}%`,
  17. }"
  18. >
  19. </div>
  20. <div class="text">
  21. LOADING...
  22. </div>
  23. </div>
  24. </template>
  25. <script setup>
  26. import { ref, computed, watch, onMounted } from "vue"
  27. import { useRoute, useRouter } from "vue-router"
  28. import { useStore } from "vuex"
  29. const route = useRoute()
  30. const router = useRouter()
  31. const store = useStore()
  32. const emit = defineEmits(['loading-over'])
  33. const progress = ref(0)
  34. let intervalId = null
  35. onMounted(() => {
  36. intervalId = setInterval(() => {
  37. progress.value += 0.03
  38. if (progress.value >= 0.96) {
  39. clearInterval(intervalId)
  40. progress.value = 1
  41. emit('loading-over')
  42. }
  43. }, 100)
  44. })
  45. </script>
  46. <style lang="less" scoped>
  47. .start-up{
  48. position: absolute;
  49. left: 0;
  50. top: 0;
  51. width: 100%;
  52. height: 100%;
  53. z-index: 100;
  54. background-color: #fff;
  55. background-image: url(@/assets/images/start-up-bg.jpg);
  56. background-size: cover;
  57. background-repeat: no-repeat;
  58. background-position: center center;
  59. >.loading-bar{
  60. position: absolute;
  61. bottom: 103px;
  62. left: 50%;
  63. transform: translate(-50%, 0);
  64. width: calc(1325 / 1920 * 100%);
  65. height: 14px;
  66. border-radius: 7px;
  67. background: rgba(0,0,0,0.19);
  68. border: 1px solid #FFFFFF;
  69. >.loading-progress{
  70. position: absolute;
  71. left: 0;
  72. top: 0;
  73. height: 100%;
  74. background: #FF8888;
  75. border-radius: 7px;
  76. }
  77. >img.cursor {
  78. position: absolute;
  79. bottom: 100%;
  80. transform: translate(-50%, 0);
  81. width: 73px;
  82. }
  83. }
  84. >.text{
  85. position: absolute;
  86. bottom: 48px;
  87. left: 50%;
  88. transform: translate(-50%, 0);
  89. font-family: Source Han Sans CN, Source Han Sans CN;
  90. font-weight: 400;
  91. font-size: 30px;
  92. color: #FF9494;
  93. line-height: 35px;
  94. }
  95. }
  96. </style>