Vue 3 模块化作品集主页,浅色极简风格,中英双语懒加载 i18n。 - 模块注册表(import.meta.glob)约定式收集项目模块,新增页签无需改导航/路由 - i18n: 中文同步注入主 chunk,英文动态 import() 拆独立 chunk,仅切换时下载 - 第一个页签 mobile-game: 展示 448/449 移动游戏毕设(概览/截图轮播/版本时间线/团队/排行榜/ML视频) - 排行榜复用 /449/449rest.php,失败优雅降级 - 构建: vite outDir=/root/html,emptyOutDir=false,产物用 mainPage/ 命名空间 - 样式: CSS 变量令牌,无 UI 框架运行时依赖
22 lines
816 B
JavaScript
22 lines
816 B
JavaScript
// ★ 模块注册表 -- 扩展点核心
|
||
// 用 import.meta.glob 约定式收集每个子模块的 index.js,
|
||
// 自动生成统一的项目列表。新增项目页签 = 新建 modules/<新项目>/ 文件夹,
|
||
// 无需改动导航/路由代码。
|
||
//
|
||
// 每个模块 index.js 默认导出形如:
|
||
// {
|
||
// id: 'mobile-game', // 唯一标识,同时用作路由 path
|
||
// tabKey: 'tabs.mobileGame', // i18n 键,用于页签标题
|
||
// order: 1, // 页签排序
|
||
// component: () => import('./MobileGame.vue') // 懒加载组件
|
||
// }
|
||
|
||
const moduleFiles = import.meta.glob('./*/index.js', { eager: true })
|
||
|
||
const modules = Object.values(moduleFiles)
|
||
.map((mod) => mod.default)
|
||
.filter(Boolean)
|
||
.sort((a, b) => (a.order ?? 99) - (b.order ?? 99))
|
||
|
||
export default modules
|