vue-image-viewer
vue-image-viewer
a simple and lightweight picture viewer. Demo
一个用于Vue2.0的简单且轻量化的图片查看器。
Install
npm install vue-image-viewer --save
Usage
import imageViewer from "vue-image-viewer";
Vue.use(imageViewer);
export default {
data() {
return {
images : [
{
name : "image1",
url : "/static/images/1.jpg"
},
{
name : "image2",
url : "/static/images/2.png"
},
{
url : "/static/images/3.gif"
}
]
}
},
created() {
this.$imageViewer.images(this.images);
},
methods : {
imageView(index) {
this.$imageViewer.index(index);
this.$imageViewer.show();
}
}
}
<img v-for="(item,index) in images" :key="index" :src="https://raw.githubusercontent.com/ChiHai-Chuck/vue-image-viewer/HEAD/item.url" @click="imageView(index)">
Events
| Name | Params | Type | Description |
|---|---|---|---|
| show | - | - | Open picture viewer. |
| hide | - | - | Close picture viewer. |
| index | num |
Number |
Which image to show first. |
| page | num |
Number |
The page of the thumbnail list. |
| images | data |
Array |
Set image list. |
Related Packages
@dullar/mercury
Advanced and highly reusable Mobile UI Components built on Vue2 & You can define...
8,553
6
vite-plugin-git-revision
Vite plugin that generates VERSION and COMMITHASH files during build based on a...
21,961
11
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.1.8 | ^2.5.17 | MIT | |
| 1.1.7 | ^2.5.17 | MIT | |
| 1.1.6 | ^2.5.17 | MIT | |
| 1.1.5 | ^2.5.17 | MIT | |
| 1.1.3 | ^2.5.17 | MIT | |
| 1.1.2 | ^2.5.17 | MIT | |
| 1.1.1 | ^2.5.17 | MIT | |
| 1.1.0 | ^2.5.17 | MIT | |
| 1.0.3 | ^2.5.3 | MIT | |
| 1.0.2 | ^2.5.3 | MIT | |
| 1.0.1 | ^2.3.2 | MIT | |
| 1.0.0 | MIT |