View.Pc.vue 3.2 KB

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