Files
Yi.Admin/Yi.Bbs.Vue3/src/layout/Index.vue

82 lines
1.6 KiB
Vue
Raw Normal View History

2023-12-14 10:15:23 +08:00
<template>
<div class="common-layout">
2024-01-02 21:02:35 +08:00
<el-container class="common-container">
2023-12-14 17:05:39 +08:00
<el-header
class="common-header"
ref="header"
:class="[isFixed ? 'fixed' : '']"
>
2023-12-14 10:15:23 +08:00
<AppHeader />
</el-header>
2024-06-08 00:13:29 +08:00
<el-main id="main-box" class="common-main">
2023-12-14 16:25:38 +08:00
<AppBody />
2023-12-14 10:15:23 +08:00
</el-main>
</el-container>
</div>
</template>
<script setup>
2023-12-14 17:05:39 +08:00
import { ref, onMounted } from "vue";
2023-12-14 16:25:38 +08:00
import AppHeader from "./AppHeader.vue";
import AppBody from "./AppBody.vue";
2023-12-14 17:05:39 +08:00
const header = ref(null);
const isFixed = ref(false);
onMounted(() => {
window.addEventListener("scroll", handleScroll);
});
const handleScroll = () => {
const scrollTop =
window.scrollY ||
document.documentElement.scrollTop ||
document.body.scrollTop;
const currentEle = header.value.$el;
if (scrollTop > currentEle.offsetTop) {
isFixed.value = true;
} else {
isFixed.value = false;
}
};
2023-12-14 10:15:23 +08:00
</script>
2023-12-14 16:25:38 +08:00
<style scoped lang="scss">
.common {
2023-12-24 20:05:34 +08:00
&-layout {
width: 100%;
2025-08-05 14:09:39 +08:00
// height: 100%;
2023-12-24 20:05:34 +08:00
}
2024-01-02 21:02:35 +08:00
&-container {
width: 100%;
2025-08-05 14:09:39 +08:00
// height: 100%;
2024-01-02 21:02:35 +08:00
}
2023-12-14 16:25:38 +08:00
&-header {
width: 100%;
2025-08-04 22:35:45 +08:00
background: #0A0B0C;
2023-12-24 20:05:34 +08:00
box-shadow: rgba(0, 0, 0, 0.1) -4px 9px 25px -6px;
2023-12-24 20:58:18 +08:00
height: 60px;
2023-12-14 16:25:38 +08:00
display: flex;
justify-content: center;
}
2023-12-24 20:05:34 +08:00
&-main {
2025-08-04 18:27:18 +08:00
2025-08-04 22:35:45 +08:00
background: linear-gradient(135deg, #0a0a0a 0%, #0d1520 30%, #0a0a0a 70%, #0f1520 100%),linear-gradient(135deg, rgba(0, 255, 136, 0.03) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 255, 136, 0.02) 100%);
2023-12-24 20:05:34 +08:00
}
2023-12-14 16:25:38 +08:00
}
.el-main {
2023-12-14 10:15:23 +08:00
margin: 0;
2023-12-14 16:25:38 +08:00
padding: 0;
min-height: 10rem;
2023-12-14 10:15:23 +08:00
}
2023-12-14 17:05:39 +08:00
.fixed {
position: fixed;
top: 0;
left: 0;
right: 0;
2023-12-16 11:17:28 +08:00
z-index: 99999;
2023-12-14 17:05:39 +08:00
}
2023-12-14 16:25:38 +08:00
</style>
2025-08-04 23:29:25 +08:00