[Improvement] ImagePreview: suppot onClose callback (#1589)

This commit is contained in:
neverland
2018-08-05 17:37:35 +08:00
committed by GitHub
parent 6f6bed4eb9
commit 428cb5059a
5 changed files with 74 additions and 21 deletions
+10 -5
View File
@@ -17,6 +17,12 @@
<script>
import { ImagePreview } from '../../../packages';
const images = [
'https://img.yzcdn.cn/upload_files/2017/03/15/FkubrzN7AgGwLlTeb1E89-T_ZjBg.png',
'https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg',
'https://img.yzcdn.cn/upload_files/2017/03/15/FvexrWlG_WxtCE9Omo5l27n_mAG_.jpeg'
];
export default {
i18n: {
'zh-CN': {
@@ -33,11 +39,10 @@ export default {
methods: {
showImagePreview(position, timer) {
const instance = ImagePreview([
'https://img.yzcdn.cn/upload_files/2017/03/15/FkubrzN7AgGwLlTeb1E89-T_ZjBg.png',
'https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg',
'https://img.yzcdn.cn/upload_files/2017/03/15/FvexrWlG_WxtCE9Omo5l27n_mAG_.jpeg'
], typeof position === 'number' ? position : 0);
const instance = ImagePreview({
images,
startPosition: typeof position === 'number' ? position : 0
});
if (timer) {
setTimeout(() => {