storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.68k stars 9.32k forks source link

Support for Vue's composition API #8478

Closed Swinejamin closed 5 years ago

Swinejamin commented 5 years ago

Is your feature request related to a problem? Please describe. Writing components with Vue's composition API causes stories to break. It appears that the setup() function is never called.

Describe the solution you'd like Provide support for the API.

Describe alternatives you've considered Provide a way to manually call the setup function before mounting the component.

Are you able to assist bring the feature to reality? Not currently.

Aaron-Pool commented 5 years ago

Where are you putting the call to install the plugin on the Vue instance?

Swinejamin commented 5 years ago

Ach, I didn't have it in .storybook/config.js like I thought I did. 🤦‍♂

Aaron-Pool commented 5 years ago

@Swinejamin No problem! Glad you got it sorted!

fazulk commented 5 years ago

Can I see how you got it working? I did below and its not picking up any stories.

import VueCompositionApi from '@vue/composition-api'

Vue.use(VueCompositionApi)

Swinejamin commented 5 years ago

That's all I had to add to get it working.

its not picking up any stories.

Any errors in the console? This makes me think your config isn't looking for stories properly. Are you using storiesOf or CSF? I'd start by making sure that your config matches the format of your stories. (Speaking from experience here.)

If that doesn't help, post your complete config.js?

blowsie commented 4 years ago

Since props are passed via default, they are not reactive. Should I open a new issue for this?

ChangMook-Lim commented 4 years ago

Inject vue instance in your story files

Task.stories.ts

import Vue from 'vue'
import VueCompositionApi from '@vue/composition-api'
import Task from './Task.vue'

Vue.use(VueCompositionApi)