mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 03:21:49 +08:00
29 lines
411 B
Plaintext
29 lines
411 B
Plaintext
```js
|
|
// MyComponent.stories.js
|
|
|
|
import imageFile from './static/image.png';
|
|
|
|
export default {
|
|
title: 'img',
|
|
};
|
|
|
|
const image = {
|
|
src: imageFile,
|
|
alt: 'my image',
|
|
};
|
|
|
|
export const WithAnImage = {
|
|
render: () => ({
|
|
props: {
|
|
src: {
|
|
default: () => image.src,
|
|
},
|
|
alt: {
|
|
default: () => image.alt,
|
|
},
|
|
},
|
|
template: `<img :src="src" :alt="alt"/>`,
|
|
}),
|
|
};
|
|
```
|