refactor(composables): 移除未使用的 Lenis 类型导入并优化 useHead 配置

移除未使用的 Lenis 类型导入以简化代码
在 htmlAttrs 中添加 lang 属性配置
This commit is contained in:
2026-04-27 15:41:50 +08:00
parent b7fdb21ef0
commit bb7e2c04c8
+3 -3
View File
@@ -1,6 +1,5 @@
import { onBeforeUnmount, watch, type Ref, isRef, unref, computed } from 'vue'
import { useNuxtApp, useHead } from '#imports'
import type Lenis from 'lenis'
// 全局模块级变量,用于记录锁定请求的次数,解决多组件并发锁定的竞态问题
let lenisLockCount = 0
@@ -13,8 +12,9 @@ export const usePageScrollLock = (isLocked: Ref<boolean> | boolean) => {
// SSR 和 CSR 都支持:自动将 class 注入到 HTML 标签上
useHead({
htmlAttrs: {
class: computed(() => unref(isLocked) ? 'is-home-intro-active' : '')
}
class: computed(() => unref(isLocked) ? 'is-home-intro-active' : ''),
lang: 'zh-CN',
},
})
let currentlyLocked = false