mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import { fn } from 'storybook/test';
|
|
|
|
import MyHeader from './Header.vue';
|
|
|
|
export default {
|
|
title: 'Example/Header',
|
|
component: MyHeader,
|
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
tags: ['autodocs'],
|
|
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 how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
layout: 'fullscreen',
|
|
},
|
|
args: {
|
|
onLogin: fn(),
|
|
onLogout: fn(),
|
|
onCreateAccount: fn(),
|
|
},
|
|
};
|
|
|
|
export const LoggedIn = {
|
|
args: {
|
|
user: {
|
|
name: 'Jane Doe',
|
|
},
|
|
},
|
|
};
|
|
|
|
export const LoggedOut = {
|
|
args: {
|
|
user: null,
|
|
},
|
|
};
|