storybookjs/storybook

[Bug]: Vue KeepAlive onActivated dose NOT work in storybook decorators

开放

#27,149 创建于 2024年5月15日

 (0 条评论) (0 个反应) (0 位负责人)TypeScript (10,058 个派生)batch import
bughelp wantedvue3

仓库指标

星标
 (89,909 个星标)
PR 合并指标
 (平均合并 7天 22小时) (30 天内合并 184 个 PR)

描述

Describe the bug

See Reproduce: As story title said, in 'On Activated Dose Not Invock', onActivated dosen't be called.

export default {
  title: 'Example/Page2',
  component: Page,
  decorators: [
    (story) => ({
      components: { story },
      template: `<KeepAlive><story /></KeepAlive>`, // differece: use story, not Page
    }),
  ],
};

image

But in Keepalive Works Fine, onActivatedis called.

export default {
  title: 'Example/Page',
  component: Page,
  decorators: [
    (story) => ({
      components: { Page },
      template: `<KeepAlive><Page /></KeepAlive>`,
    }),
  ],
};

image

To Reproduce

https://stackblitz.com/edit/github-lfs33b

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (12) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    pnpm: 8.14.1 - ~/.nvm/versions/node/v18.15.0/bin/pnpm <----- active
  Browsers:
    Chrome: 124.0.6367.158
    Safari: 17.4.1

Additional context

No response

贡献者指南