| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <header class="mobile-header">
- <button class="back-button" @click="goHome">
- <img src="@/assets/index/2.jpg" alt="回到首页" class="back-icon">
- </button>
- <h1 class="page-title">{{ title }}</h1>
- <button v-if="showMenu" class="hamburger-btn" @click="$emit('menu')">
- <span class="line"></span>
- <span class="line"></span>
- <span class="line"></span>
- </button>
- </header>
- </template>
- <script setup>
- import { useRouter } from 'vue-router'
- defineProps({
- title: {
- type: String,
- default: ''
- },
- showMenu: {
- type: Boolean,
- default: true
- }
- })
- const router = useRouter()
- const goHome = () => {
- router.push('/')
- }
- </script>
- <style scoped lang="less">
- .mobile-header {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 12px 16px;
- background: white;
- border-bottom: 1px solid #e5e5e5;
- position: relative;
- // z-index: 998 !important;
- }
- .back-button {
- position: absolute;
- left: 16px;
- background: transparent;
- border: none;
- cursor: pointer;
-
- .back-icon {
- width: 40px;
- height: 40px;
- }
- }
- .page-title {
- font-size: 24px;
- font-weight: 600;
- color: #1a1a1a;
- margin: 0;
- }
- .hamburger-btn {
- position: absolute;
- right: 16px;
- background: transparent;
- border: none;
- width: 32px;
- height: 24px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- padding: 0;
- cursor: pointer;
-
- .line {
- width: 100%;
- height: 2px;
- background: #2563EB;
- border-radius: 2px;
- }
- }
- </style>
|