优化并添加阻尼滚动开关

This commit is contained in:
Han 2025-03-09 12:18:18 +08:00
parent 60c91c5989
commit 0b158b7e7a
5 changed files with 11 additions and 6 deletions

View File

@ -14,6 +14,7 @@
- [x] 简洁的响应式设计
- [x] 流畅的动画和页面过渡
- [x] 丝滑的阻尼滚动效果(自定义开启/关闭)
- [x] 两列布局
- [x] 阅读时间
- [x] 字数统计
@ -27,9 +28,12 @@
- [x] 分类
- [x] 归档
- [x] 动态
- [x] 圈子
- [x] 关于
- [x] 留言板
- [x] 友情链接
- [x] 推荐文章
- [x] 置顶文章
- [x] 谷歌广告
- [x] 内置 404 页面
- [x] Sitemap 支持
@ -114,6 +118,7 @@ date: 文章创建日期
updated: 文章更新日期
cover: "封面图URL (为空默认随机内置封面 /public/assets/images/banner)"
recommend: false # 是否推荐文章
top: false # 是否置顶文章
hide: false # 是否隐藏文章
---
```

View File

@ -50,4 +50,6 @@ export default {
// 文章页广告(不填不开启)
articleAD_Slot: `<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxx" data-ad-slot="xxxxxx" data-ad-format="auto" data-full-width-responsive="true"></ins>`
},
// 阻尼滚动效果开关
LenisScroll: true
}

View File

@ -15,7 +15,7 @@ const scrollChangeFn = () => {
const backTopFn = () => {
(window as any).vhlenis && (window as any).vhlenis.stop();
window.scrollTo({ top: 0, behavior: "smooth" });
(window as any).vhlenis.start();
(window as any).vhlenis && (window as any).vhlenis.start();
};
// 页面更新,初始化函数======
// 回顶部DOM

View File

@ -1,6 +1,4 @@
import { inRouter, outRouter } from "../utils/updateRouter";
// 鼠标滚动阻尼效果
import LenisInit from './Lenis';
// 初始化文章代码块
import codeInit from "../scripts/Code";
// 初始化视频播放器
@ -31,7 +29,7 @@ import initMobileSidebar from "../scripts/MobileSidebar";
import GoogleAdInit from "../scripts/GoogleAd";
// Han Analytics 统计
import SITE_INFO from "../config";
const { HanAnalytics } = SITE_INFO;
const { HanAnalytics, LenisScroll } = SITE_INFO;
import { LoadScript } from "../utils/index";
// ============================================================
@ -41,7 +39,7 @@ const videoList: any[] = [];
const MusicList: any[] = [];
const indexInit = async (only: boolean = true) => {
// 鼠标滚动阻尼效果
only && LenisInit();
LenisScroll && only && (await import('./Lenis')).default();
// 预加载搜索数据
only && searchFn("");
// 初始化搜索功能

View File

@ -16,7 +16,7 @@ let clearTimer: any = null;
(window as any).vhlenis.stop();
clearTimer = setTimeout(() => {
(window as any).vhlenis.start();
}, 566);
}, 288);
}
} catch {
scrollStatus = null;