storybook/docs/snippets/vue/list-story-reuse-data.ts-3.ts.mdx
2022-04-23 08:48:25 +02:00

39 lines
959 B
Plaintext

```ts
// List.stories.ts
import List from './ListComponent.vue';
import ListItem from './ListItem.vue';
import { Meta, StoryFn } from '@storybook/vue3';
//👇 We're importing the necessary stories from ListItem
import { Selected, Unselected } from './ListItem.stories';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'List',
component: List,
} as Meta<typeof List>;
export const ManyItems: StoryFn<typeof List> = (args) => ({
components: { List, ListItem },
setup() {
return { ...args };
},
template: `
<List v-bind="args">
<list-item :isSelected="Selected"/>
<list-item :isSelected="Unselected"/>
<list-item :isSelected="Unselected"/>
</List>`,
});
ManyItems.args = {
Selected: Selected.args.isSelected,
Unselected: Unselected.args.isSelected,
};
```