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

33 lines
648 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) => ({
components: { Button },
setup() {
return { args };
},
template: '<List v-bind="args"/>',
}),
};
export const OneItem = {
render: (args) => ({
components: { List, ListItem },
setup() {
//👇 The args will now be passed down to the template
return { args };
},
template: '<List v-bind="args"><ListItem /></List>',
}),
};
```