View.Pc.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="title" @click="onShowDescription" :class="{ 'pull-up': showDescription, }">
  3. <div class="text">
  4. <div>{{ metadata.title }}</div>
  5. </div>
  6. <div class="icon">
  7. <i class="iconfont icon-pull-down"></i>
  8. </div>
  9. </div>
  10. <div v-if="showTitle" class="description" :class="{ show: showDescription }" @click="onShowDescription">
  11. <div class="text" v-html="metadata.description"></div>
  12. </div>
  13. </template>
  14. <script setup>
  15. import { ref, computed } from 'vue'
  16. import { useStore } from 'vuex'
  17. const store = useStore()
  18. const metadata = computed(() => store.getters['scene/metadata'])
  19. const showDescription = ref(false)
  20. const showTitle = ref(true)
  21. const onShowDescription = () => {
  22. showDescription.value = !showDescription.value
  23. }
  24. </script>
  25. <style lang="scss" scoped>
  26. .title {
  27. display: flex;
  28. align-items: center;
  29. justify-content: center;
  30. height: 100%;
  31. cursor: pointer;
  32. transition: all 0.1s;
  33. background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0) 100%);
  34. &.collapse {
  35. // width: 34px;
  36. padding-right: 0;
  37. .back-btn {
  38. .iconfont {
  39. transform: rotate(180deg);
  40. }
  41. &::after {
  42. display: none;
  43. }
  44. }
  45. .text {
  46. display: none;
  47. }
  48. .icon {
  49. display: none;
  50. }
  51. }
  52. .back-btn {
  53. width: 34px;
  54. height: 34px;
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. cursor: pointer;
  59. position: relative;
  60. transition: all 0.1s;
  61. &::after {
  62. content: '';
  63. position: absolute;
  64. width: 1px;
  65. height: 65%;
  66. background: linear-gradient(transparent, #fff, transparent);
  67. top: 50%;
  68. transform: translateY(-50%);
  69. right: 0;
  70. }
  71. }
  72. .text {
  73. // width: 190px;
  74. text-align: center;
  75. min-width: 240px;
  76. transition: width 0.3s;
  77. padding: 0 20px;
  78. > div {
  79. width: 100%;
  80. overflow: hidden;
  81. text-overflow: ellipsis;
  82. white-space: nowrap;
  83. }
  84. }
  85. .icon {
  86. i {
  87. transition: transform 0.2s ease-in-out;
  88. }
  89. }
  90. &.pull-up {
  91. background: rgba($color: #000000, $alpha: 0.5);
  92. border-radius: 17px;
  93. // .text {
  94. // width: 240px;
  95. // padding-left: 20px;
  96. // > div {
  97. // // width: 100%;
  98. // // overflow: hidden;
  99. // // text-overflow: ellipsis;
  100. // // white-space: nowrap;
  101. // }
  102. // }
  103. .icon {
  104. i {
  105. transform: rotate(180deg);
  106. }
  107. }
  108. }
  109. }
  110. .description {
  111. display: none;
  112. position: absolute;
  113. left: 50%;
  114. transform: translateX(-50%);
  115. top: calc(100% + 10px);
  116. background: rgba(15, 15, 15, 0.5);
  117. border-radius: 10px;
  118. &.show {
  119. display: block;
  120. }
  121. .text {
  122. padding: 20px;
  123. width: 400px;
  124. letter-spacing: 1px;
  125. overflow: hidden;
  126. word-break: break-all;
  127. white-space: normal;
  128. line-height: 1.5;
  129. }
  130. }
  131. </style>