This commit is contained in:
qingfeng1121
2025-09-29 18:39:17 +08:00
parent aaf326ed1f
commit 4fe6add803
7 changed files with 245 additions and 404 deletions

View File

@@ -38,7 +38,7 @@
<div id="content-section" :class="{ 'visible': isconts }">
<div class="nonsensetitle" v-if="classnonsenset">
<div class="nonsensetitleconst" v-if="windowwidth">
<div class="nonsensetitleconst">
<h1>发癫中QAQ</h1>
</div>
</div>
@@ -105,7 +105,10 @@ const handleSelect = (key: string) => {
*/
const updatePageState = (url: string) => {
classhero.value = url !== '/:type';
classnonsenset.value = url === '/nonsense';
console.log("当前路径是:"+url);
classnonsenset.value = url == '/nonsense';
console.log( classnonsenset.value);
};
/**
@@ -151,12 +154,14 @@ const handleScroll = () => {
isconts.value = true;
isScrollingleftmodlue.value = true;
}
console.log("好耶滚动了");
};
/**
* 添加滚动监听
*/
const addScrollListener = () => {
console.log("添加滚动监听");
window.addEventListener('scroll', handleScroll);
};
@@ -164,6 +169,7 @@ const addScrollListener = () => {
* 移除滚动监听
*/
const removeScrollListener = () => {
console.log("移除滚动监听");
window.removeEventListener('scroll', handleScroll);
};
@@ -178,10 +184,10 @@ const handleResize = () => {
isScrollingleftmodlue.value = true;
classnonsenset.value = false;
isconts.value = true;
removeScrollListener();
// removeScrollListener();
} else {
windowwidth.value = true;
addScrollListener();
}
};
@@ -194,7 +200,7 @@ const setActiveIndex = (locationpathname) => {
// 生命周期钩子
onMounted(() => {
handleResize();
handleResize(); addScrollListener();
window.addEventListener('resize', handleResize);
// 初始进入时如果是首页,启动打字机
if (window.location.pathname === '/:type') {
@@ -203,10 +209,9 @@ onMounted(() => {
});
onUnmounted(() => {
removeScrollListener();
// removeScrollListener();
window.removeEventListener('resize', handleResize);
if (heroTimer) clearInterval(heroTimer);
});
</script>
<style>
</style>
<style></style>