titieSlide.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div v-if="currentScene.type == 'pano'">
  3. <transition name="fade">
  4. <div v-if="titleshow" class="titieSlide">
  5. {{ currentScene.name }}
  6. </div>
  7. </transition>
  8. </div>
  9. </template>
  10. <script setup>
  11. import { ref, onMounted, computed, watch, nextTick } from "vue";
  12. import { useStore } from "vuex";
  13. const store = useStore();
  14. const currentScene = computed(() => store.getters["scene/currentScene"]);
  15. const timer = ref(null)
  16. const titleshow = ref(false)
  17. watch(currentScene, () => {
  18. if (!currentScene.value) {
  19. return
  20. }
  21. if (timer.value) {
  22. clearInterval(timer.value)
  23. timer.value = null
  24. }
  25. titleshow.value = true
  26. timer.value = setTimeout(() => {
  27. titleshow.value = false
  28. }, 3000);
  29. })
  30. </script>
  31. <style lang="scss" scoped>
  32. .titieSlide {
  33. position: absolute;
  34. top: 60px;
  35. left: 50%;
  36. transform: translateX(-50%);
  37. font-weight: bold;
  38. font-size: 24px;
  39. z-index: 999;
  40. color: #FFFFFF;
  41. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
  42. }
  43. @media screen and (max-width: 800px) {
  44. .titieSlide {
  45. font-size: 20px;
  46. }
  47. }
  48. </style>