style(GradientHeader): 调整布局和样式以提升可读性和交互性
调整了按钮和标题的布局,使其在显示返回按钮时居中。添加了 z-index 以确保元素层叠顺序正确,提升用户体验。
Showing
1 changed file
with
7 additions
and
4 deletions
| 1 | <template> | 1 | <template> |
| 2 | <header class="bg-gradient-to-r from-green-50 to-blue-50 p-4 relative"> | 2 | <header class="bg-gradient-to-r from-green-50 to-blue-50 p-4 relative"> |
| 3 | - <div class="flex items-center justify-between"> | 3 | + <div class="flex items-center justify-between relative"> |
| 4 | <button | 4 | <button |
| 5 | v-if="showBackButton" | 5 | v-if="showBackButton" |
| 6 | @click="onBack" | 6 | @click="onBack" |
| 7 | - class="p-2 rounded-full bg-white/30 backdrop-blur-sm" | 7 | + class="p-2 rounded-full bg-white/30 backdrop-blur-sm z-10" |
| 8 | aria-label="返回" | 8 | aria-label="返回" |
| 9 | > | 9 | > |
| 10 | <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | 10 | <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 11 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" /> | 11 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" /> |
| 12 | </svg> | 12 | </svg> |
| 13 | </button> | 13 | </button> |
| 14 | - <h1 :class="['text-xl font-medium text-center', showBackButton ? 'flex-1' : '']"> | 14 | + <h1 :class="{ |
| 15 | + 'absolute left-1/2 -translate-x-1/2': showBackButton, | ||
| 16 | + 'text-xl font-medium': true | ||
| 17 | + }"> | ||
| 15 | {{ title }} | 18 | {{ title }} |
| 16 | </h1> | 19 | </h1> |
| 17 | - <div v-if="rightContent" v-html="rightContent.content"></div> | 20 | + <div v-if="rightContent" class="z-10" v-html="rightContent.content"></div> |
| 18 | </div> | 21 | </div> |
| 19 | </header> | 22 | </header> |
| 20 | </template> | 23 | </template> | ... | ... |
-
Please register or login to post a comment