Skip to content

vite 应用在后台管理系统中,如何做 tab 页签缓存 #752

@eric-he-ehsy

Description

@eric-he-ehsy

Describe the bug

Image 我试了,如果这样动态函数式创建组件,与 keepalive 结合使用,切换 tab 的时候,缓存要么就是第一次不行,要么就是清理不掉,onBeforeUnmount 也会触发多次, ,切换跳转用的是 router = useRouter(); 来跳转的 你们内部有试过 tabs 的缓存吗,而且 store 主应用也子应用共享,如果通过 props 传递主应用的 store ,在 script 里能正确获取到,但是监控不到 主应用store 的变化

Reproduction

main

Used Package Manager

npm

System Info

System:
    OS: macOS 26.1
    CPU: (10) arm64 Apple M4
    Memory: 211.56 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.19.5 - /Users/applebad/.nvm/versions/node/v20.19.5/bin/node
    Yarn: 1.22.22 - /Users/applebad/.nvm/versions/node/v20.19.5/bin/yarn
    npm: 10.8.2 - /Users/applebad/.nvm/versions/node/v20.19.5/bin/npm
    pnpm: 10.20.0 - /Users/applebad/.nvm/versions/node/v20.19.5/bin/pnpm
  Browsers:
    Safari: 26.1
  npmPackages:
    @garfish/bridge-vue-v3: ^1.19.7 => 1.19.7 
    garfish: ^1.19.7 => 1.19.7

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions