houzhongjian
2024-08-08 820397e43a0b64d35c6d31d2a55475061438593b
提交 | 用户 | 时间
820397 1 <template>
H 2   <div class="title-bar">
3     <el-image v-if="property.bgImgUrl" :src="property.bgImgUrl" fit="cover" class="w-full" />
4     <div class="absolute left-0 top-0 w-full">
5       <!-- 标题 -->
6       <div
7         :style="{
8           fontSize: `${property.titleSize}px`,
9           fontWeight: property.titleWeight,
10           color: property.titleColor,
11           textAlign: property.textAlign
12         }"
13         v-if="property.title"
14       >
15         {{ property.title }}
16       </div>
17       <!-- 副标题 -->
18       <div
19         :style="{
20           fontSize: `${property.descriptionSize}px`,
21           fontWeight: property.descriptionWeight,
22           color: property.descriptionColor,
23           textAlign: property.textAlign
24         }"
25         class="m-t-8px"
26         v-if="property.description"
27       >
28         {{ property.description }}
29       </div>
30     </div>
31     <!-- 更多 -->
32     <div
33       class="more"
34       v-show="property.more.show"
35       :style="{
36         color: property.descriptionColor
37       }"
38     >
39       <span v-if="property.more.type !== 'icon'"> {{ property.more.text }} </span>
40       <Icon icon="ep:arrow-right" v-if="property.more.type !== 'text'" />
41     </div>
42   </div>
43 </template>
44 <script setup lang="ts">
45 import { TitleBarProperty } from './config'
46
47 /** 标题栏 */
48 defineOptions({ name: 'TitleBar' })
49
50 defineProps<{ property: TitleBarProperty }>()
51 </script>
52 <style scoped lang="scss">
53 .title-bar {
54   position: relative;
55   width: 100%;
56   min-height: 20px;
57   box-sizing: border-box;
58
59   /* 更多 */
60   .more {
61     position: absolute;
62     top: 0;
63     right: 8px;
64     bottom: 0;
65     display: flex;
66     margin: auto;
67     font-size: 10px;
68     color: #969799;
69     align-items: center;
70     justify-content: center;
71   }
72 }
73 </style>