feat(docs): 顶栏右侧按模块动态切换版本#134
Merged
Merged
Conversation
将 #132 在各导航项下方展示的版本小标签改为顶栏右侧的 a-select 版本切换器(对齐 antdv-next 主站风格),并随当前模块切换显示对应子包版本: - 新增 useActiveHeaderItem composable:按当前路由解析激活的导航项及对应子包 version - header-navigation.vue:移除每个导航项下方的 versionTag 渲染与样式,恢复简洁横向导航 - header-actions.vue:右侧新增 a-select 版本切换器,currentVersion 跟随激活模块的 activeVersion 变化;无版本模块(研发/演示)自动隐藏;options 暂只含当前版本,为后续 versionList 多版本切换铺垫
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#132 将版本以小标签形式展示在每个顶栏导航项下方。现希望对齐 antdv-next 主站风格,改为顶栏右侧的版本切换器,并且切换到不同模块时展示该模块对应子包的版本,同时为后续的多版本列表(versionList)切换做铺垫。
改动
1. 新增
useActiveHeaderItemcomposablepackages/docs/src/composables/use-header-active.ts按当前路由解析激活的导航项,暴露
activeItem/activeKey/activeVersion,供顶栏导航与右侧版本切换器共用,避免重复计算。2.
header-navigation.vue移除 #132 在每个导航项下方渲染的
versionTag(含绝对定位样式与移动端响应式),恢复为简洁的横向导航;activeKey改由 composable 提供。3.
header-actions.vue(右侧动作区)新增
a-select版本切换器,参考 antdv-next 主站:currentVersion跟随激活模块的activeVersion变化(watch同步),切换模块即自动切换显示的包版本v-if="currentVersion")versionOptions暂时只包含当前版本,为后续 versionList 多版本切换铺垫(替换为历史版本列表即可生效)size="small"variant="filled"min-width: 86px,对齐主站模块 → 版本映射
@antdv-next/xx/package.json@antdv-next/x-markdownx-markdown/package.json@antdv-next/x-cardx-card/package.json@antdv-next/x-sdkx-sdk/package.json@antdv-next/x-skillx-skill/package.json版本数据仍由
config/header.ts的version字段统一维护。验证
vp lint✅ 0 warnings / 0 errorsvp check --fix✅ 格式已规范;既有 2 个x-markdown/vite.build.config.ts类型错误为 main 上已存在(与本 PR 无关,CI 仅跑vp test)vp test✅ 43 files / 407 tests passed后续
versionOptions替换为各包的历史版本列表 + 切换跳转逻辑即可完成 versionList 多版本切换。