# image-viewer-vue

> A Vue.js project for viewing image

Latest version **2.0.6** (published 2018-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-viewer-vue
pnpm add image-viewer-vue
yarn add image-viewer-vue
bun add image-viewer-vue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2018-11-12 |
| First published | 2018-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 278.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | EgoYau |
| Maintainers | egoyau |
| Keywords | vue, image, viewer, image-viewer, imageViewer, viewImage, browse, image-browse, imageBrowse, browseImage |

## Links

- npm: https://www.npmjs.com/package/image-viewer-vue
- Repository: https://github.com/EgoYau/image-viewer-vue
- Homepage: https://github.com/EgoYau/image-viewer-vue#readme
- Issues: https://github.com/EgoYau/image-viewer-vue/issues
- npm.io page: https://npm.io/package/image-viewer-vue

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.5.11

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.6 (latest) — 2018-11-12
- 2.0.5 — 2018-11-01
- 2.0.4 — 2018-11-01
- 2.0.3 — 2018-10-31
- 2.0.2 — 2018-10-31
- 2.0.1 — 2018-10-30
- 2.0.0 — 2018-10-30
- 1.0.21 — 2018-10-30
- 1.0.20 — 2018-10-30
- 1.0.19 — 2018-10-30
- 1.0.16 — 2018-07-16
- 1.0.15 — 2018-07-16
- 1.0.14 — 2018-07-16
- 1.0.13 — 2018-07-16
- 1.0.9 — 2018-04-17
- … 8 more at https://npm.io/package/image-viewer-vue/versions

## README

# image-viewer-vue
[![NPM version](https://img.shields.io/npm/v/image-viewer-vue.svg)](https://www.npmjs.org/package/image-viewer-vue) [![Build Status](https://travis-ci.org/EgoYau/image-viewer-vue.svg?branch=master)](https://travis-ci.org/EgoYau/image-viewer-vue)
> A Vue.js project for viewing image

# Getting Started

## Installing
```
npm install image-viewer-vue --save
```
> Depend on 'Spin' of iview, please install iview in your project, and you can load components on demand

## Usage
+ import in main.js

```
import imageViewer from 'image-viewer-vue'
Vue.use(imageViewer)
```

+ example

```
<template>
  <div>
    <button @click="imageViewerFlag = true">点击查看图片</button>
    <image-viewer-vue 
        v-if="imageViewerFlag" 
        @closeImageViewer="imageViewerFlag = false" 
        @clickImage="clickImage"
        :imgUrlList="imgUrlList"
        :index="currentIndex"
        :title="title"
        :closable=true
        :cyclical=false>
    </image-viewer-vue>
  </div>
</template>
<script>
    export default {
        data() {
            return {
                imageViewerFlag: false,
                currentIndex: 1,
                title: '图片',
                imgUrlList: ['url1','url2','url3']
            }
        },
        methods:{
            clickImage: function(index){
                console.log(index)
            }
        }
    }
</script>
```
# Props
| Name | Type | Required | Description | Default |
| :- | :- | :- | :- | :- | 
| `imgUrlList` | `Array`| `true` | image url list | `[]` |
| `index` | `Number`| `false` | which image to show first | `0` |
| `title` | `String`| `false` | image's title | `图片` |
| `alt` | `String`| `false` | the property of img tag | `图片` |
| `closable` | `Boolean`| `false` | the imageViewer will close when clicked blank | `true` |
| `cyclical` | `Boolean`| `false` | browse pictures can be repeated | `true` |

# Methods
| Name | Description | Params |
| :- | :- | :- | 
| `closeImageViewer` | the callback for closing imageViewer | null |
| `clickImage` | the callback for clicking the image | the index for the image which clicked |
| `imageLoadSuccess` | the callback for loading success | the index for the image which loaded success |
| `imageLoadError` | the callback for loading error | the index for the image which loaded error |

# Built With
+ [vue](https://cn.vuejs.org)
+ [iview](https://www.iviewui.com)

---
_Source: https://npm.io/package/image-viewer-vue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
