mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-17 00:05:59 +08:00
40 lines
876 B
JavaScript
40 lines
876 B
JavaScript
import MyHeader from './Header.vue';
|
|
|
|
export default {
|
|
title: 'Example/Header',
|
|
component: MyHeader,
|
|
render: (args) => ({
|
|
// Components used in your story `template` are defined in the `components` object
|
|
components: {
|
|
MyHeader,
|
|
},
|
|
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
setup() {
|
|
// Story args can be spread into the returned object
|
|
return {
|
|
...args,
|
|
};
|
|
},
|
|
// Then, the spread values can be accessed directly in the template
|
|
template: '<my-header :user="user" />',
|
|
}),
|
|
parameters: {
|
|
// More on Story layout: https://storybook.js.org/docs/vue/configure/story-layout
|
|
layout: 'fullscreen',
|
|
},
|
|
};
|
|
|
|
export const LoggedIn = {
|
|
args: {
|
|
user: {
|
|
name: 'Jane Doe',
|
|
},
|
|
},
|
|
};
|
|
|
|
export const LoggedOut = {
|
|
args: {
|
|
user: null,
|
|
},
|
|
};
|