提交 | 用户 | 时间
|
37b204
|
1 |
<template> |
H |
2 |
<div class="tab-bar"> |
|
3 |
<div |
|
4 |
class="tab-bar-bg" |
|
5 |
:style="{ |
|
6 |
background: |
|
7 |
property.style.bgType === 'color' |
|
8 |
? property.style.bgColor |
|
9 |
: `url(${property.style.bgImg})`, |
|
10 |
backgroundSize: '100% 100%', |
|
11 |
backgroundRepeat: 'no-repeat' |
|
12 |
}" |
|
13 |
> |
|
14 |
<div v-for="(item, index) in property.items" :key="index" class="tab-bar-item"> |
|
15 |
<el-image :src="index === 0 ? item.activeIconUrl : item.iconUrl"> |
|
16 |
<template #error> |
|
17 |
<div class="h-full w-full flex items-center justify-center"> |
|
18 |
<Icon icon="ep:picture" /> |
|
19 |
</div> |
|
20 |
</template> |
|
21 |
</el-image> |
|
22 |
<span :style="{ color: index === 0 ? property.style.activeColor : property.style.color }"> |
|
23 |
{{ item.text }} |
|
24 |
</span> |
|
25 |
</div> |
|
26 |
</div> |
|
27 |
</div> |
|
28 |
</template> |
|
29 |
<script setup lang="ts"> |
|
30 |
import { TabBarProperty } from './config' |
|
31 |
|
|
32 |
/** 页面底部导航栏 */ |
|
33 |
defineOptions({ name: 'TabBar' }) |
|
34 |
|
|
35 |
defineProps<{ property: TabBarProperty }>() |
|
36 |
</script> |
|
37 |
<style lang="scss" scoped> |
|
38 |
.tab-bar { |
|
39 |
z-index: 2; |
|
40 |
width: 100%; |
|
41 |
|
|
42 |
.tab-bar-bg { |
|
43 |
display: flex; |
|
44 |
flex-direction: row; |
|
45 |
align-items: center; |
|
46 |
justify-content: space-around; |
|
47 |
padding: 8px 0; |
|
48 |
|
|
49 |
.tab-bar-item { |
|
50 |
display: flex; |
|
51 |
width: 100%; |
|
52 |
font-size: 12px; |
|
53 |
flex-direction: column; |
|
54 |
align-items: center; |
|
55 |
justify-content: center; |
|
56 |
|
|
57 |
:deep(img), |
|
58 |
.el-icon { |
|
59 |
width: 26px; |
|
60 |
height: 26px; |
|
61 |
border-radius: 4px; |
|
62 |
} |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
66 |
</style> |