https://github.com/john015/vue-load-image
A Vue component for showing loader during image loading https://john015.github.io/vue-load-image/
https://github.com/john015/vue-load-image
image image-loader image-preloader loader vue vue-components vue-image vue-image-loader vue-load-image vue3 vue3-image-loader vuejs
Last synced: 3 months ago
JSON representation
A Vue component for showing loader during image loading https://john015.github.io/vue-load-image/
- Host: GitHub
- URL: https://github.com/john015/vue-load-image
- Owner: john015
- License: mit
- Created: 2018-11-21T07:23:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:01:26.000Z (almost 3 years ago)
- Last Synced: 2024-04-25T21:22:54.458Z (over 1 year ago)
- Topics: image, image-loader, image-preloader, loader, vue, vue-components, vue-image, vue-image-loader, vue-load-image, vue3, vue3-image-loader, vuejs
- Language: Vue
- Homepage:
- Size: 1.86 MB
- Stars: 66
- Watchers: 2
- Forks: 8
- Open Issues: 13
-
Metadata Files:
- Readme: README-ko.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vue - vue-load-image - A Vue component for showing loader during image loading https://john015.github.io/vue-load-image/ ` π 7 months ago` (UI Components [π](#readme))
- awesome-vue - vue-load-image β 17 - display loader during image loading, as well as by display alternate content when the image fails to load. (UI Components / Form)
- awesome-vue - vue-load-image - display loader during image loading, as well as by display alternate content when the image fails to load. (Components & Libraries / UI Components)
- awesome-vue - vue-load-image - display loader during image loading, as well as by display alternate content when the image fails to load. (UI Components / Form)
README
[English](./README.md) | νκ΅μ΄
# vue-load-image
[](https://www.npmjs.com/package/vue-load-image)  [](https://www.npmjs.com/package/vue-load-image) [](https://github.com/john015/vue-load-image/blob/master/LICENSE)
vue-load-image λ μ΄λ―Έμ§λ‘λ μ€ μ΄λ―Έμ§ λ‘λλ₯Ό νμνλ©° μ΄λ―Έμ§λ‘λμ μ€ν¨ νμλ λ체 λ΄μ©μ νμνλ 1KB(gzipped size) Vue component μ
λλ€.
## Demo
[vue-load-image Demo](https://john015.github.io/vue-load-image/) / [(Source Code)](https://github.com/john015/vue-load-image/tree/master/example)
## Installation
### Via NPM:
```bash
# for Vue 2.x
npm i vue-load-image
# for Vue 3.x
npm i vue-load-image@next
```
### Via CDN:
```html
```
## Usage
### Image
#### Vue 2.x
```js
error message
import VueLoadImage from 'vue-load-image'
export default {
components: {
'vue-load-image': VueLoadImage
}
}
```
#### Vue 3.x
```js
Image load fails
import VueLoadImage from 'vue-load-image'
export default {
components: {
'vue-load-image': VueLoadImage
}
}
```
### Background-image
#### Vue 2.x
```js
error message
import VueLoadImage from 'vue-load-image'
export default {
components: {
'vue-load-image': VueLoadImage
}
}
```
#### Vue 3.x
```js
Image load fails
import VueLoadImage from 'vue-load-image'
export default {
components: {
'vue-load-image': VueLoadImage
}
}
```
#### β οΈμ μμ¬ν
data-src κ°μ background-image url κ³Ό λμΌνκ² μ€μ ν΄μ£ΌμΈμ.
## Events
| Name | Description |
| --------- | ------------------------------------------ |
| `onError` | μ΄λ―Έμ§ λ‘λ μ€ν¨μ onError κ° νΈμΆ λ©λλ€. |
| `onLoad` | μ΄λ―Έμ§κ° λ‘λλλ©΄ onLoad κ° νΈμΆ λ©λλ€. |
## Slots
μ΄λ―Έμ§κ° μ±κ³΅μ μΌλ‘ λ‘λ λλ©΄ "image" slot μ΄ λ λλ§ λ©λλ€.
μ΄λ―Έμ§κ° λ‘λ μ€μΌ λ "preloader" slot μ΄ λ λλ§λ©λλ€.
μ΄λ―Έμ§λ‘λμ μ€ν¨νλ©΄ "error" slot μ΄ λ λλ§λ©λλ€.