ModelKey 路由测试
2025/8/18小于 1 分钟
ModelKey 路由测试
这个页面用于测试基于 modelKey
的新路由系统。
ModelKey 路由测试
测试新闻卡片 (modelKey: 'article')
2025-01-18
测试新闻标题
这是一个测试新闻的描述内容
测试见解卡片 (modelKey: 'insight')
2025-01-18
测试见解标题
这是一个测试见解的描述内容
兼容性测试 (contentType: 'insight')
2025-01-18
兼容性测试标题
这是一个兼容性测试的描述内容
导航函数测试
工具函数测试结果
测试说明
1. 路由判断逻辑
系统按以下优先级判断内容类型:
modelKey 字段(最高优先级)
'article'
→/news/
路由'insight'
→/insights/
路由
contentType 字段(兼容性)
'insight'
→/insights/
路由- 其他 →
/news/
路由
category 字段(兼容性)
- 包含 'insight' 或 '见解' →
/insights/
路由 - 其他 →
/news/
路由
- 包含 'insight' 或 '见解' →
默认值
- 无法判断时默认为
'article'
→/news/
路由
- 无法判断时默认为
2. 工具函数
getModelKey(contentItem)
- 获取内容的 modelKeygetContentPath(contentId, modelKey)
- 生成内容路径navigateToContent(contentItem, defaultModelKey)
- 智能导航getContentTypeName(modelKey)
- 获取类型显示名称isInsightContent(contentItem)
- 判断是否为见解isNewsContent(contentItem)
- 判断是否为新闻
3. 预期结果
点击不同的卡片和按钮,应该:
- modelKey 为 'article' 的内容跳转到
/news/
路由 - modelKey 为 'insight' 的内容跳转到
/insights/
路由 - 兼容性测试应该正确识别 contentType 和 category 字段