-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Argstable not being generated for Vue3 components using vue-class-component syntax #14052
Comments
It turns out that |
Hi, I had the same problem. I found this little workaround. Maybe it helps. import {Vue, Options} from 'vue-property-decorator'
// Create an alias for Options
const Component = Options;
// Instead of @Options do @Component
@Component({
name: 'Icon'
})
export default class Icon extends Vue {
// ...
} The trick here is to alias the Options Decorator to |
This gets me:
|
We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:
|
Describe the bug
I made a new example project with typescript and vue-class-component using Vue-cli. Then installed storybook and made a new story for one of the components that use the vue-class-component syntax. Storybook won't generate a proper argstable for props specified these components. It doesnt show an error, but does show a warning in the developer console:
./src/stories/Button-class.vueModule Warning (from ./node_modules/vue-docgen-loader/lib/index.js):[vue-docgen-loader] failed to parse the component file with docgen-api: Cannot read property 'get' of undefined
To Reproduce
Steps to reproduce the behavior:
npx sb@next init
Expected behavior
It should generate an argstable using vue-class-component style syntax, as it does for composition API components
Screenshots
Left is a button using vue-class-component, right is the default button using composition API
Notice the difference in the argstable. The argstable only shows arguments you have set in the story. It for example omits the on click event.
this is what happens then you don't supply any argument values to a story: (again: left uses vue-class-component, right composition API)
Edit: important detail, the button doesnt render because one of the props is 'required'. This is not the issue
Code snippets
I made an example repo which i'm also using to test my storybook configuration.
https://github.com/Benjamindudok/vue-3-storybook-mdx-example
System
System:
OS: Windows 10 10.0.19041
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 88.0.4324.182
Edge: Spartan (44.19041.423.0), Chromium (88.0.705.74)
npmPackages:
@storybook/addon-actions: ^6.2.0-beta.1 => 6.2.0-beta.1
@storybook/addon-essentials: ^6.2.0-beta.1 => 6.2.0-beta.1
@storybook/addon-links: ^6.2.0-beta.1 => 6.2.0-beta.1
@storybook/preset-scss: ^1.0.3 => 1.0.3
@storybook/vue3: ^6.2.0-beta.1 => 6.2.0-beta.1
Additional context
I don't know for sure vue-class-component in vue3 is supported by vue-docgen-api. I think it did work for vue2. Vue-docgen-api also has examples in their repo to test against: https://github.com/vue-styleguidist/vue-styleguidist/blob/dev/packages/vue-docgen-api/tests/components/class-component/Button.vue
The text was updated successfully, but these errors were encountered: