moblie-website/src/components/Header.vue

217 lines
5.1 KiB
Vue
Raw Normal View History

2025-01-21 23:37:04 +08:00
<template>
2025-03-13 23:57:46 +08:00
<div class="navbar flex justify-between items-center">
<div class="flex items-center gap-[10px]">
<van-image class="logo" :src="logoIcon" />
<span>三优云试剂管家</span>
2025-01-21 23:37:04 +08:00
</div>
2025-03-13 23:57:46 +08:00
<van-icon name="wap-nav" @click="goMenu" class="menu-icon" :src="menuIcon" />
2025-02-15 21:04:05 +08:00
</div>
2025-03-13 23:57:46 +08:00
<van-popup
v-model:show="show"
class="menu-popup"
position="left"
duration="0.4"
:transition-appear="true"
:style="{ width: '80%', height: '100%' }"
@close="handleClose" >
<div class="menu-container">
<div class="menu-header">
<van-image class="logo" :src="logoIcon" />
<div class="menu-header-title">三优云试剂管家</div>
</div>
<div class="menu-list">
<div class="menu-item" @click="goAbout">
<div class="menu-item-icon">
<van-icon name="miniprogram-o" />
</div>
<div class="menu-item-title" :class="{ active: currentTag === 'about' }">关于三优</div>
<div v-if="currentTag === 'about'" class="menu-item-arrow">
<van-icon name="success" />
</div>
</div>
<div class="menu-item" :class="{ active: currentTag === 'home' }" @click="goIndex">
<div class="menu-item-icon">
<van-icon name="home-o" />
</div>
<div class="menu-item-title">首页</div>
<div v-if="currentTag === 'home'" class="menu-item-arrow">
<van-icon name="success" />
</div>
</div>
<div class="menu-item" :class="{ active: currentTag === 'contact' }" @click="goContact">
<div class="menu-item-icon">
<van-icon name="phone-o" />
</div>
<div class="menu-item-title">联系我们</div>
<div v-if="currentTag === 'contact'" class="menu-item-arrow">
<van-icon name="success" />
</div>
</div>
</div>
<div class="menu-footer">
<div class="w-full">
<img class="w-full" src="../assets/Vector 21.png" alt="" />
</div>
<div class="menu-footer-item">@ 三优生物医药上海有限公司</div>
</div>
</div>
</van-popup>
2025-01-21 23:37:04 +08:00
</template>
<script setup>
2025-03-13 23:57:46 +08:00
import { defineProps, ref } from "vue";
2025-02-24 23:35:10 +08:00
import { useRouter } from 'vue-router';
2025-03-13 23:57:46 +08:00
import logoIcon from '../assets/image 111.png';
import menuIcon from '../assets/menu.png';
2025-02-15 21:04:05 +08:00
// 接收父组件传递的 activeTag
const props = defineProps({
activeTag: {
type: String,
default: "home", // 可以定义默认值
},
});
2025-02-24 23:35:10 +08:00
2025-03-13 23:57:46 +08:00
const currentTag = ref(props.activeTag);
2025-02-24 23:35:10 +08:00
const router = useRouter();
const goIndex = () => {
2025-03-13 23:57:46 +08:00
currentTag.value = 'home';
2025-02-24 23:35:10 +08:00
router.push('/');
};
const goContact = () => {
2025-03-13 23:57:46 +08:00
currentTag.value = 'contact';
2025-02-24 23:35:10 +08:00
router.push('/contact');
};
2025-01-21 23:37:04 +08:00
2025-03-13 23:57:46 +08:00
const goAbout = () => {
currentTag.value = 'about';
window.location.href = 'https://www.sanyoubio.com.cn';
};
const show = ref(false);
const isRotated = ref(false);
const goMenu = () => {
// isRotated.value = !isRotated.value;
show.value = true;
2025-02-15 21:04:05 +08:00
}
2025-02-18 23:36:50 +08:00
2025-03-13 23:57:46 +08:00
const handleClose = () => {
isRotated.value = false;
show.value = false;
2025-02-15 21:04:05 +08:00
}
2025-03-13 23:57:46 +08:00
</script>
2025-02-18 23:36:50 +08:00
2025-03-13 23:57:46 +08:00
<style lang="less" scoped>
.menu-popup {
width: 100%;
height: 100%;
background: #00203b;
color: #ffffff;
.menu-container {
width: 100%;
height: 100%;
padding: 50px 0;
.menu-header {
display: flex;
align-items: center;
justify-content: start;
padding: 10px 40px;
.menu-header-title {
font-size: 20px;
font-weight: 600;
margin-left: 10px;
}
}
}
.menu-list {
margin-top: 50px;
.menu-item {
height: 64px;
line-height: 64px;
font-size: 16px;
margin-bottom: 20px;
padding-left: 40px;
display: flex;
align-items: center;
position: relative;
&.active {
background: rgb(31, 60, 100);
.menu-item-icon {
font-weight: bold;
color: #000000;
background: #fff;
}
}
.menu-item-icon {
width: 37px;
height: 37px;
font-size: 20px;
background-color: rgb(45, 73, 110);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20px;
}
.menu-item-arrow {
position: absolute;
right: 40px;
font-size: 20px;
top: 0;
bottom: 0;
right: 40px;
margin: auto;
}
}
}
.menu-footer {
position: absolute;
bottom: 10px;
left: 0;
right: 0;
width: 100%;
height: 60px;
.menu-footer-item {
display: flex;
align-items: center;
justify-content: center;
height: 44px;
line-height: 44px;
font-size: 12px;
// padding-left: 40px;
}
}
2025-02-18 23:36:50 +08:00
}
2025-03-13 23:57:46 +08:00
.navbar {
width: 100%;
height: 44px;
min-height: 44px;
background: #fff;
padding: 0 16px;
color: rgb(66, 110, 163);
font-size: 16px;
font-weight: 600;
2025-02-18 23:36:50 +08:00
2025-03-13 23:57:46 +08:00
}
.logo {
width: 63px;
height: 28px;
}
.menu-icon {
font-size: 24px;
color: #000;
transition: transform 0.3s ease;
&.rotate {
transform: rotate(90deg);
}
}
2025-01-21 23:37:04 +08:00
</style>