Skip to content

Commit 661e8d2

Browse files
committed
feat: update readme
1 parent 71425bb commit 661e8d2

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ $ npm i --save vue-lazy-load-image-component
1111

1212
## `LazyLoadImage` usage
1313

14-
```javascript
15-
import React from 'react';
16-
import { LazyLoadImage } from 'vue-lazy-load-image-component';
17-
18-
const MyImage = ({ image }) => (
14+
```vue
15+
<template>
1916
<div>
20-
<LazyLoadImage
21-
alt={image.alt}
22-
height={image.height}
23-
src={image.src} // use normal <img> attributes as props
24-
width={image.width} />
25-
<span>{image.caption}</span>
17+
<MyImage :image="image" />
18+
<span>{{image.caption}}</span>
2619
</div>
27-
);
28-
29-
export default MyImage;
20+
</template>
21+
<script lang='ts' setup>
22+
import { LazyLoadImage } from 'vue-lazy-load-image-component';
23+
const image = ref({
24+
alt: 'My image',
25+
height: 100,
26+
src: 'https://example.com/image.jpg',
27+
width: 100,
28+
caption: 'My image caption',
29+
});
30+
</script>
3031
```
3132

3233
### Props

0 commit comments

Comments
 (0)