mirror of
https://github.com/RhenCloud/Cloud-Home.git
synced 2026-01-22 17:39:07 +08:00
style(app): 使用 NuxtImg 替代 img 标签
在多个组件中将 `img` 标签替换为 `NuxtImg` 标签,提升图片加载的性能和优化。例如,在 `AboutSection.vue`、`FriendsSection.vue`、`HeroSection.vue`、`ProjectsSection.vue`、`SitesSection.vue` 和 `SkillsSection.vue` 中的图片标签。 refactor(app): 扩展 `nuxt.config.ts` 配置 扩展了 `nuxt.config.ts` 配置文件中的模块配置,添加了 `@nuxt/image` 和 `@nuxt/eslint` 模块。同时,优化了 `routeRules` 配置,以支持预渲染和增量静态生成。
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import { defineNuxtPlugin } from "#app";
|
||||
import siteConfig from "~/config/siteConfig";
|
||||
|
||||
type NeteaseMiniPlayerGlobal = {
|
||||
init?: () => void;
|
||||
};
|
||||
|
||||
type NeteaseWindow = Window & {
|
||||
NeteaseMiniPlayer?: NeteaseMiniPlayerGlobal;
|
||||
__NETEASE_MUSIC_CONFIG__?: unknown;
|
||||
};
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
if (import.meta.server) return;
|
||||
|
||||
@@ -35,7 +44,7 @@ export default defineNuxtPlugin(() => {
|
||||
const ensureScript = () =>
|
||||
new Promise<void>((resolve) => {
|
||||
// 检查全局对象是否已存在,表示脚本已加载
|
||||
const anyWin = window as any;
|
||||
const anyWin = window as NeteaseWindow;
|
||||
if (anyWin.NeteaseMiniPlayer) {
|
||||
resolve();
|
||||
return;
|
||||
@@ -62,7 +71,7 @@ export default defineNuxtPlugin(() => {
|
||||
});
|
||||
|
||||
const initPlayer = () => {
|
||||
const anyWin = window as any;
|
||||
const anyWin = window as NeteaseWindow;
|
||||
|
||||
// 将 siteConfig 的音乐配置传递给全局 window 对象
|
||||
if (!anyWin.__NETEASE_MUSIC_CONFIG__) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Router } from "vue-router";
|
||||
import siteConfig from "~/config/siteConfig";
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
if (!process.client) return;
|
||||
if (!import.meta.client) return;
|
||||
if (!siteConfig.umami?.enable) return;
|
||||
|
||||
// 跳过在 localhost 环境下加载 Umami
|
||||
|
||||
Reference in New Issue
Block a user