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

貢獻者指南