1
1
# Vue preview plugin
2
2
3
- > 一个Vue集成 [ PhotoSwipe] ( https://github.com/dimsemenov/PhotoSwipe ) 图片预览插件
3
+ > 一 A Vue Integrated [ PhotoSwipe] ( https://github.com/dimsemenov/PhotoSwipe ) Image Preview Plugin
4
4
5
5
![ ] ( https://img.shields.io/npm/dm/vue-preview.svg )
6
6
![ ] ( https://img.shields.io/npm/v/vue-preview.svg )
@@ -17,13 +17,12 @@ npm i vue-preview -S
17
17
18
18
## Usage
19
19
20
- 使用须知:
20
+ Notice:
21
+ - This plugin currently support vue2.0 and above
22
+ - ` img ` tag class can not be removed
21
23
22
- * 插件目前仅支持vue2.0以上版本
23
- * img标签上的class不能去掉
24
+ If you are using ` vue-cli ` generated projects, you may need to modify the ` webpack.base.conf.js ` file loaders and add a loader. The reason is the plugin uses ES6 syntax, so you need to compile the code.
24
25
25
- 如果你是使用vue-cli生成的项目,可能需要你修改` webpack.base.conf.js ` 文件中的loaders,添加一个loader。
26
- 原因:插件编写中使用了es6的语法,需要进行代码编译
27
26
``` javascript
28
27
{
29
28
test: / vue-preview. src. *? js$ / ,
@@ -40,7 +39,7 @@ Vue.use(VuePreview)
40
39
41
40
### Examples
42
41
43
- ```
42
+ ``` html
44
43
<template >
45
44
<img class =" preview-img" v-for =" (item, index) in list" :src =" item.src" height =" 100" @click =" $preview.open(index, list)" >
46
45
</template >
@@ -64,19 +63,19 @@ export default {
64
63
</script >
65
64
```
66
65
67
- ### Mothods
66
+ ### Methods
68
67
69
- 插件提供以下两个方法, ``` vm ``` 代表组件实例
68
+ The plugin provides the following two methods, ` vm ` represents a component instance:
70
69
71
70
#### vm.$preview.open(index, list, options)
72
71
73
- 参数说明:
72
+ Parameters Description:
74
73
75
- | 参数 | 说明 | 类型 | 必需
76
- | :--: | :--: | :--: | :--:
77
- | index |当前图片的索引值 | Number | 是
78
- | list |图片列表 | Array | 是
79
- | options |预览插件的配置选项( [ 参考PhotoSwipe配置 ] ( http://photoswipe.com/documentation/options.html ) ) | Object | 否
74
+ | Parameters | Description | Type | Required
75
+ | :--- | :--- | :--- | :---
76
+ | index |The index of the current image | Number | Yes
77
+ | list |Image list | Array | Yes
78
+ | options |Configuration options for Preview Plugin ( [ see PhotoSwipe Configuration ] ( http://photoswipe.com/documentation/options.html ) ) | Object | No
80
79
81
80
#### vm.$preview.close()
82
81
0 commit comments