修正头脚高度布局计算
This commit is contained in:
parent
5a9711a936
commit
74e990a4ad
@ -17,9 +17,6 @@
|
|||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
border-top: 1px solid #ececec;
|
border-top: 1px solid #ececec;
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
letter-spacing: 5px;
|
letter-spacing: 5px;
|
||||||
border-top: 5px solid #ececec;
|
border-top: 5px solid #ececec;
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -22,72 +22,67 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FiEELogo from "@/assets/image/header/logo.png";
|
import FiEELogo from '@/assets/image/header/logo.png'
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
import { NMenu, NLayoutHeader, NImage } from "naive-ui";
|
import { NMenu, NLayoutHeader, NImage } from 'naive-ui'
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from 'vue-router'
|
||||||
import { useHeaderMenuConfig } from "@/config/headerMenuConfig";
|
import { useHeaderMenuConfig } from '@/config/headerMenuConfig'
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n()
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
|
|
||||||
// 使用统一的菜单配置
|
// 使用统一的菜单配置
|
||||||
const menuOptions = useHeaderMenuConfig();
|
const menuOptions = useHeaderMenuConfig()
|
||||||
const selectedKey = ref(null);
|
const selectedKey = ref(null)
|
||||||
|
|
||||||
const isScrolled = ref(false);
|
const isScrolled = ref(false)
|
||||||
|
|
||||||
// 递归查找菜单项
|
// 递归查找菜单项
|
||||||
function findMenuOptionByKey(options, key) {
|
function findMenuOptionByKey(options, key) {
|
||||||
for (const option of options) {
|
for (const option of options) {
|
||||||
if (option.key === key) return option;
|
if (option.key === key) return option
|
||||||
if (option.children) {
|
if (option.children) {
|
||||||
const found = findMenuOptionByKey(option.children, key);
|
const found = findMenuOptionByKey(option.children, key)
|
||||||
if (found) return found;
|
if (found) return found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// 菜单点击跳转
|
// 菜单点击跳转
|
||||||
const handleMenuSelect = (key) => {
|
const handleMenuSelect = (key) => {
|
||||||
const option = findMenuOptionByKey(menuOptions, key);
|
const option = findMenuOptionByKey(menuOptions, key)
|
||||||
if (option && option.href) {
|
if (option && option.href) {
|
||||||
router.push(option.href);
|
router.push(option.href)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// 监听滚动事件
|
// 监听滚动事件
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
//滚动距离大于100px时,处理对应的header样式
|
//滚动距离大于100px时,处理对应的header样式
|
||||||
isScrolled.value = window.scrollY >= 100;
|
isScrolled.value = window.scrollY >= 100
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener("scroll", handleScroll);
|
window.addEventListener('scroll', handleScroll)
|
||||||
});
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener("scroll", handleScroll);
|
window.removeEventListener('scroll', handleScroll)
|
||||||
});
|
})
|
||||||
|
|
||||||
//点击回到首页
|
//点击回到首页
|
||||||
const handleToHome = () => {
|
const handleToHome = () => {
|
||||||
router.push("/myhome");
|
router.push('/myhome')
|
||||||
selectedKey.value = null; // 重置菜单选中状态
|
selectedKey.value = null // 重置菜单选中状态
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.custom-header {
|
.custom-header {
|
||||||
--header-height: 80px;
|
--header-height: 80px;
|
||||||
--primary-color: #8b59f7;
|
--primary-color: #8b59f7;
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
height: var(--header-height);
|
height: var(--header-height);
|
||||||
@ -143,7 +138,7 @@ const handleToHome = () => {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@ -189,7 +184,7 @@ const handleToHome = () => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "";
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -108,11 +108,6 @@ const handleToHome = () => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.custom-header {
|
.custom-header {
|
||||||
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
height: 320px;
|
height: 320px;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { NCarousel, NDivider, NMarquee, NPopselect } from 'naive-ui'
|
|
||||||
import { onUnmounted, ref, watch, onMounted, computed } from 'vue'
|
|
||||||
|
|
||||||
import customHeader from '@/components/customHeader/index.vue'
|
import customHeader from '@/components/customHeader/index.vue'
|
||||||
import customFooter from '@/components/customFooter/index.vue'
|
import customFooter from '@/components/customFooter/index.vue'
|
||||||
</script>
|
</script>
|
||||||
@ -9,15 +6,13 @@ import customFooter from '@/components/customFooter/index.vue'
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-screen">
|
<div class="flex flex-col h-screen">
|
||||||
<customHeader></customHeader>
|
<customHeader></customHeader>
|
||||||
<div class="bg-[url('@/assets/image/bg-pc.png')] bg-cover bg-center flex-1" style="margin: 80px 0;">
|
<div
|
||||||
<router-view />
|
class="bg-[url('@/assets/image/bg-pc.png')] bg-cover bg-center flex-1 overflow-auto"
|
||||||
</div>
|
>
|
||||||
<customFooter></customFooter>
|
<router-view />
|
||||||
|
</div>
|
||||||
|
<customFooter></customFooter>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss"></style>
|
||||||
main {
|
|
||||||
padding: var(--header-height, 80px) 0 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -1,38 +1,18 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { NCarousel, NDivider, NMarquee, NPopselect } from 'naive-ui'
|
|
||||||
import { onUnmounted, ref, watch, onMounted, computed } from 'vue'
|
|
||||||
|
|
||||||
import customHeader from '@/components/customHeader/index.vue'
|
import customHeader from '@/components/customHeader/index.vue'
|
||||||
import customFooter from '@/components/customFooter/index.vue'
|
import customFooter from '@/components/customFooter/index.vue'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- <header className="header">
|
|
||||||
375
|
|
||||||
</header> -->
|
|
||||||
<!-- <main ref="main"></main> -->
|
|
||||||
<div class="flex flex-col h-screen">
|
<div class="flex flex-col h-screen">
|
||||||
<customHeader />
|
<customHeader />
|
||||||
<div class="bg-[url('@/assets/image/bg-mobile.png')] bg-cover bg-center flex-1 overflow-auto">
|
<div
|
||||||
<router-view />
|
class="bg-[url('@/assets/image/bg-mobile.png')] bg-cover bg-center flex-1 overflow-auto"
|
||||||
|
>
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
|
<customFooter />
|
||||||
</div>
|
</div>
|
||||||
<customFooter />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss"></style>
|
||||||
.background-image {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('@/assets/image/bg-375.png');
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background-position: center center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-attachment: fixed;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user