storybookjs/vue-cli-plugin-storybook

Support for Vue's composition API

Closed this issue · 2 comments

Not sure if this belongs here or the main storybook package.

Writing components using the composition api (API Reference) breaks stories, even though the components work perfectly when running the full app normally. It appears that the setup() function is never called. Components will still render within the story, but anything that depends on a returned method or property will fail with an error: Property or method "XXXX" is not defined on the instance but referenced during render.

For anyone with a similar issue, I simply neglected to add the following to .storybook/config.js:

import VueCompositionApi from '@vue/composition-api';
Vue.use(VueCompositionApi);

Doesn't work with Storybook 6