feat: 新增共享记事本页签(iframe 嵌入 + 存活校验)与集中配置
- 新增 whiteboard 模块:iframe 嵌入 f.zikai.wang/wb/shared,骨架屏+降级外链 - 存活校验:模块声明 requiresAlive,启动时 no-cors 探测 /health 一次, 服务挂掉则隐藏页签(刷新页面才重探) - 集中配置 src/config/app.config.js:白板 URL/探针/默认记事本 id 统一管理 - 容错强化:注册表/路由/useProjects 单模块异常不影响其他页签,删除一个页签 仅需删其模块文件夹并重新 build - i18n:tabs.whiteboard / common.serviceUnavailable / whiteboard.openExternal - README 精简重写:仅保留项目结构、基础设施、Ubuntu 从0安装、新增页签
This commit is contained in:
@@ -2,18 +2,29 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import modules from '../modules/index.js'
|
||||
|
||||
const moduleRoutes = modules
|
||||
.map((m) => {
|
||||
try {
|
||||
return {
|
||||
path: `/${m.id}`,
|
||||
name: m.id,
|
||||
component: m.component,
|
||||
meta: { moduleId: m.id }
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`[router] 模块 ${m?.id} 路由生成失败,已跳过:`, e)
|
||||
return null
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: modules.length ? `/${modules[0].id}` : '/404'
|
||||
redirect: moduleRoutes.length ? moduleRoutes[0].path : '/404'
|
||||
},
|
||||
// 每个模块一条路由,组件懒加载
|
||||
...modules.map((m) => ({
|
||||
path: `/${m.id}`,
|
||||
name: m.id,
|
||||
component: m.component,
|
||||
meta: { moduleId: m.id }
|
||||
})),
|
||||
...moduleRoutes,
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'not-found',
|
||||
|
||||
Reference in New Issue
Block a user