Skip to content

Commit

Permalink
Added documentation note for vue decorators. (#8642)
Browse files Browse the repository at this point in the history
Added documentation note for vue decorators.
  • Loading branch information
shilman committed Nov 30, 2019
1 parent b100410 commit 02f28e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/src/pages/basics/writing-stories/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ import { addDecorator } from '@storybook/react';
addDecorator(storyFn => <div style={{ textAlign: 'center' }}>{storyFn()}</div>);
```

> \* In Vue projects you have to use the special component `<story/>` instead of the function parameter `storyFn` that is used in React projects, even if you are using JSX, for example:
> ```jsx
> var decoratorVueJsx = () => ({ render() { return <div style={{ textAlign: 'center' }}><story/></div>} })
> addDecorator(decoratorVueJsx)
>
> var decoratorVueTemplate = () => { return { template: `<div style="text-align:center"><story/></div>` }
> addDecorator(decoratorVueTemplate)
> ```
And here's an example of component/local decorators. The component decorator wraps all the stories in a yellow frame, and the story decorator wraps a single story in an additional red frame.
```jsx
Expand Down

0 comments on commit 02f28e9

Please sign in to comment.