storybook/docs/snippets/vue/list-story-with-sub-components.2.js.mdx
2021-08-28 01:52:57 +01:00

28 lines
596 B
Plaintext

```js
// List.stories.js
import List from './List.vue';
import ListItem from './ListItem.vue';
export default {
component: List,
subcomponents: { ListItem }, //👈 Adds the ListItem component as a subcomponent
};
export const Empty = {
render: (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { List },
template: '<List v-bind="$props"/>',
}),
};
export const OneItem = {
render: (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { List, ListItem },
template: '<List v-bind="$props"><ListItem /></List>',
}),
};
```