mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
feat(ImagePreview): add closeable prop (#5654)
This commit is contained in:
@@ -12,6 +12,12 @@
|
||||
</van-button>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('button4')">
|
||||
<van-button type="primary" @click="showImagePreview(0, 0, true)">
|
||||
{{ $t('button4') }}
|
||||
</van-button>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('button3')">
|
||||
<van-button type="primary" @click="showImagePreview(0, 3000)">
|
||||
{{ $t('button3') }}
|
||||
@@ -45,6 +51,7 @@ export default {
|
||||
button1: '预览图片',
|
||||
button2: '指定初始位置',
|
||||
button3: '异步关闭',
|
||||
button4: '展示关闭按钮',
|
||||
componentCall: '组件调用',
|
||||
index: index => `第${index + 1}页`,
|
||||
},
|
||||
@@ -52,6 +59,7 @@ export default {
|
||||
button1: 'Show Images',
|
||||
button2: 'Custom Start Position',
|
||||
button3: 'Async Close',
|
||||
button4: 'Show Close Icon',
|
||||
componentCall: 'Component Call',
|
||||
index: index => `Page: ${index}`,
|
||||
},
|
||||
@@ -74,12 +82,13 @@ export default {
|
||||
this.index = index;
|
||||
},
|
||||
|
||||
showImagePreview(position, timer) {
|
||||
showImagePreview(position, timer, closeable) {
|
||||
const instance = ImagePreview({
|
||||
images,
|
||||
lazyLoad: true,
|
||||
swipeDuration: 300,
|
||||
asyncClose: !!timer,
|
||||
closeable,
|
||||
closeOnPopstate: true,
|
||||
startPosition: typeof position === 'number' ? position : 0,
|
||||
});
|
||||
|
Reference in New Issue
Block a user