liuyun da6edcfcfd
Some checks are pending
CI / backend (push) Waiting to run
CI / frontend (push) Waiting to run
feat(layout): 多页签 keep-alive(子模块 + openspec change)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-11 22:13:25 +08:00

1.1 KiB
Raw Blame History

Why

多页签已存在,但切换页签时组件会被重建,滚动位置、搜索筛选、表单输入等状态全部丢失,后台高频「列表↔详情/表单」切换体验差。需要为布局内菜单页面启用 keep-alive,切换页签保留状态、关闭页签销毁状态。

What Changes

  • 布局内菜单页面启用 keep-alive:切换页签保留组件状态,关闭页签销毁;默认缓存,页面可通过路由 meta keepAlive: false 关闭缓存。
  • 为 11 个菜单页面补充组件 name(keep-alive 缓存标识),布局用 <keep-alive :include> 按「打开且未关闭缓存」的页签 name 集合缓存。

Capabilities

Modified Capabilities

  • frontend/AD/layout: 「多页签」需求新增 keep-alive 状态保留/销毁行为。

Impact

  • 前端:layouts/default.vue(router-view 包 keep-alive)、stores/modules/tabs.ts(path→name 辅助 + keepAlive 字段)、11 个菜单页面加 defineOptions({ name })(可声明 meta.keepAlive: false 关闭缓存)。
  • 无后端/数据变更。