mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
33 lines
648 B
Plaintext
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>',
|
|
}),
|
|
};
|
|
```
|