Skip to content
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

DOCS improve registration in VueJs guide #6608

Merged
merged 6 commits into from
Apr 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/src/pages/guides/guide-vue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ Button
└── as a component
```

> If your story is returning a plain template you can only use globally registered components.
>
> To register them, use `Vue.component('my-button', Mybutton)` in your `config.js` file.
>
> <details>
> <summary>details</summary>
>
> If your story returns a plain string like below, you will need to register globally each VueJs component that it uses.
>
> ```js
> .add('with text', () => '<my-component>with text</my-component>')
> ```
>
> In big solutions, globally registered components can conflict with each other.
>
> Here are two other ways to use components in your stories without globally registering them.
>
> - register components locally in the "components" member of the vue component object. See the story "as a component" above.
> - use a JSX render function like below. No need to register anything.
>
> ```jsx
> .add('with text', () => ({
> render: h => <my-component>with text</my-component>
> }))
> ```
>
> </details>

## Finally: Run your Storybook

Now everything is ready. Run your storybook with:
Expand Down