mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:52:07 +08:00
33 lines
674 B
Plaintext
33 lines
674 B
Plaintext
```ts
|
|
// List.stories.ts
|
|
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
|
|
import List from './List.vue';
|
|
import ListItem from './ListItem.vue';
|
|
|
|
const meta = {
|
|
component: List,
|
|
subcomponents: { ListItem }, //👈 Adds the ListItem component as a subcomponent
|
|
} satisfies Meta<typeof List>;
|
|
export default meta;
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Empty: Story = {
|
|
render: () => ({
|
|
components: { List },
|
|
template: '<List />',
|
|
}),
|
|
};
|
|
|
|
export const OneItem: Story = {
|
|
render: (args) => ({
|
|
components: { List, ListItem },
|
|
setup() {
|
|
return { args }
|
|
}
|
|
template: '<List v-bind="args"><ListItem /></List>',
|
|
}),
|
|
};
|
|
```
|