123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <div class="title" @click="onShowDescription" :class="{ 'pull-up': showDescription, collapse: !showTitle }">
- <div class="back-btn" @click.stop="showTitle = !showTitle">
- <i class="iconfont icon-_back"></i>
- </div>
- <div class="text">
- <div>{{ metadata.title }}</div>
- </div>
- <div class="icon">
- <i class="iconfont icon-pull-down"></i>
- </div>
- </div>
- <div v-if="showTitle" class="description" :class="{ show: showDescription }" @click="onShowDescription">
- <div class="text" v-html="metadata.description"></div>
- </div>
- </template>
- <script setup>
- import { ref, computed } from 'vue'
- import { useStore } from 'vuex'
- const showTitle = ref(true)
- const store = useStore()
- const metadata = computed(() => store.getters['scene/metadata'])
- const showDescription = ref(false)
- const onShowDescription = () => {
- showDescription.value = !showDescription.value
- }
- </script>
- <style lang="scss" scoped>
- .title {
- display: flex;
- align-items: center;
- padding-right: 30px;
- width: 100%;
- height: 100%;
- cursor: pointer;
- transition: all 0.1s;
- &.collapse {
- // width: 34px;
- padding-right: 0;
- .back-btn {
- .iconfont {
- transform: rotate(180deg);
- }
- &::after {
- display: none;
- }
- }
- .text {
- display: none;
- }
- .icon {
- display: none;
- }
- }
- .back-btn {
- width: 34px;
- height: 34px;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- position: relative;
- transition: all 0.1s;
- &::after {
- content: '';
- position: absolute;
- width: 1px;
- height: 65%;
- background: linear-gradient(transparent, #fff, transparent);
- top: 50%;
- transform: translateY(-50%);
- right: 0;
- }
- }
- .text {
- // width: 190px;
- width: 240px;
- padding-left: 20px;
- transition: width 0.3s;
- > div {
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .icon {
- i {
- transition: transform 0.2s ease-in-out;
- }
- }
- &.pull-up {
- // .text {
- // width: 240px;
- // padding-left: 20px;
- // > div {
- // // width: 100%;
- // // overflow: hidden;
- // // text-overflow: ellipsis;
- // // white-space: nowrap;
- // }
- // }
- .icon {
- i {
- transform: rotate(180deg);
- }
- }
- }
- }
- .description {
- display: none;
- position: absolute;
- left: 10px;
- top: calc(100% + 10px);
- background: rgba(15, 15, 15, 0.3);
- border-radius: 10px;
- &.show {
- display: block;
- }
- .text {
- padding: 20px;
- width: 400px;
- letter-spacing: 1px;
- overflow: hidden;
- word-break: break-all;
- white-space: normal;
- line-height: 1.5;
- }
- }
- </style>
|