storybook/docs/snippets/vue/page-story-slots.ts-2.ts.mdx
2022-11-30 20:25:47 +00:00

42 lines
1.0 KiB
Plaintext

```ts
// Page.stories.ts
import Page from './Page.vue';
import type { Meta, StoryObj } from '@storybook/vue';
const meta: Meta<typeof Page> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Page',
component: Page,
};
export default meta;
type Story = StoryObj<typeof Page>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/7.0/vue/api/csf
* to learn how to use render functions.
*/
export const Primary: Story = {
render: (args, { argTypes }) => ({
components: { Page },
props: Object.keys(argTypes),
template: `
<page v-bind="$props">
<template v-slot:footer>
<footer v-if="footer" v-html="footer"/>
</template>
</page>
`,
}),
args: {
footer: '<a href="https://storybook.js.org/">Built with Storybook</a>',
},
};
```