's'
This commit is contained in:
@@ -82,5 +82,49 @@ async function getThemeToolsDataFallback(): Promise<{
|
||||
return mod.default;
|
||||
}
|
||||
|
||||
export type ResourceData = {
|
||||
books: Array<{ cover: string; title: string; href: string }>;
|
||||
products: Array<{ image: string; name: string; href: string }>;
|
||||
pan: {
|
||||
categories: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
icon: string;
|
||||
items: Array<{ name: string; desc: string; href: string }>;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
|
||||
/** 加载资源导航数据:图书、商业数码、网盘 */
|
||||
export async function getResourceData(): Promise<ResourceData> {
|
||||
const theme = CURRENT_THEME;
|
||||
if (theme === "digital-nomad") {
|
||||
const [booksMod, productsMod, panMod] = await Promise.all([
|
||||
import("@/content/themes/digital-nomad/data/books.json"),
|
||||
import("@/content/themes/digital-nomad/data/products.json"),
|
||||
import("@/content/themes/digital-nomad/data/pan.json"),
|
||||
]);
|
||||
return {
|
||||
books: booksMod.default.books,
|
||||
products: productsMod.default.products,
|
||||
pan: panMod.default,
|
||||
};
|
||||
}
|
||||
return getResourceDataFallback();
|
||||
}
|
||||
|
||||
async function getResourceDataFallback(): Promise<ResourceData> {
|
||||
const [booksMod, productsMod, panMod] = await Promise.all([
|
||||
import("@/content/themes/digital-nomad/data/books.json"),
|
||||
import("@/content/themes/digital-nomad/data/products.json"),
|
||||
import("@/content/themes/digital-nomad/data/pan.json"),
|
||||
]);
|
||||
return {
|
||||
books: booksMod.default.books,
|
||||
products: productsMod.default.products,
|
||||
pan: panMod.default,
|
||||
};
|
||||
}
|
||||
|
||||
export { CURRENT_THEME, THEME_IDS };
|
||||
export type { ThemeId };
|
||||
|
||||
Reference in New Issue
Block a user