tj
2025-03-13 06ce56512a391225c73f561377ae210874273a61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
    <div class="header">
        <div style="width: 600px;">
            <el-menu :default-active="menuIndex" class="main-menu" mode="horizontal" @select="handleSelect">
                <el-menu-item index="/">
                    <img src="@/assets/logo/logo.png" alt="云游四方" class="logo" />
                    <span class="logo-text">云游四方</span>
                </el-menu-item>
                <el-menu-item index="/">首页</el-menu-item>
                <el-menu-item index="/product">产品中心</el-menu-item>
                <el-menu-item index="/contact">联系我们</el-menu-item>
                <el-menu-item index="/about">关于我们</el-menu-item>
            </el-menu>
        </div>
        <div class="contact-phone">
            <el-icon>
                <Phone />
            </el-icon>
            <span>400-102-8686</span>
        </div>
    </div>
</template>
 
<script setup>
import { ref } from 'vue';
import { Phone } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router';
 
const router = useRouter();
 
 
// 默认选中的菜单项
const menuIndex = ref('home');
 
// 处理菜单点击事件
const handleSelect = (index) => {
    // console.log('选中菜单:', index);
    router.push(index);
};
</script>
<style scoped>
.el-menu--horizontal {
    --el-menu-horizontal-height: 40px;
}
 
.header {
    display: flex;
    /* align-items: center; */
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}
 
.logo {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}
 
.logo-text {
    font-size: 18px;
    font-weight: bold;
}
 
.contact-phone {
    display: flex;
    align-items: center;
    font-size: 14px;
}
 
.main-menu {
    flex: 1;
    justify-content: center;
    height: 100%;
}
 
 
.contact-phone {
    width: 300px;
    display: flex;
    align-items: center;
    color: #0056b3;
    text-align: left;
}
 
.contact-phone .el-icon {
    margin-right: 5px;
}
</style>