1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00

[improvement] ImagePreview: add loop prop ()

This commit is contained in:
neverland 2018-11-18 10:03:45 +08:00 committed by GitHub
parent 10f0604ad0
commit 0dbf1c5ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

@ -14,6 +14,7 @@
</div> </div>
<swipe <swipe
ref="swipe" ref="swipe"
:loop="loop"
:initial-swipe="startPosition" :initial-swipe="startPosition"
:show-indicators="showIndicators" :show-indicators="showIndicators"
@change="onChange" @change="onChange"
@ -63,6 +64,10 @@ export default create({
type: Array, type: Array,
default: () => [] default: () => []
}, },
loop: {
type: Boolean,
default: true
},
startPosition: { startPosition: {
type: Number, type: Number,
default: 0 default: 0

@ -53,4 +53,5 @@ setTimeout(() => {
| startPosition | Start position | `Number` | `0` | | startPosition | Start position | `Number` | `0` |
| showIndex | Whether to show index | `Boolean` | `true` | | showIndex | Whether to show index | `Boolean` | `true` |
| showIndicators | Whether to show indicators | `Boolean` | `false` | | showIndicators | Whether to show indicators | `Boolean` | `false` |
| loop | Whether to enable loop | `Boolean` | `true` |
| onClose | Close callback | `Function` | - | | onClose | Close callback | `Function` | - |

@ -5,11 +5,12 @@ import { isServer } from '../utils';
let instance; let instance;
const defaultConfig = { const defaultConfig = {
value: true,
images: [], images: [],
loop: true,
value: true,
showIndex: true, showIndex: true,
showIndicators: false, startPosition: 0,
startPosition: 0 showIndicators: false
}; };
const initInstance = () => { const initInstance = () => {

@ -61,4 +61,5 @@ setTimeout(() => {
| startPosition | 图片预览起始位置索引 | `Number` | `0` | 1.1.16 | | startPosition | 图片预览起始位置索引 | `Number` | `0` | 1.1.16 |
| showIndex | 是否显示页码 | `Boolean` | `true` | 1.3.4 | | showIndex | 是否显示页码 | `Boolean` | `true` | 1.3.4 |
| showIndicators | 是否显示轮播指示器 | `Boolean` | `false` | 1.3.10 | | showIndicators | 是否显示轮播指示器 | `Boolean` | `false` | 1.3.10 |
| loop | 是否开启循环播放 | `Boolean` | `true` | 1.4.4 |
| onClose | 关闭时的回调函数 | `Function` | - | 1.1.16 | | onClose | 关闭时的回调函数 | `Function` | - | 1.1.16 |