gp-designer 1.0.103 → 1.0.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/gp-designer.es.js +592 -586
- package/dist/gp-designer.umd.js +11 -11
- package/dist/spa/topic/js/index.js +2 -1
- package/dist/spa/topic/js/photoswipe.js +32 -0
- package/dist/spa/topic/photoswipe/photoswipe-lightbox.esm.js +1960 -0
- package/dist/spa/topic/photoswipe/photoswipe-lightbox.esm.js.map +1 -0
- package/dist/spa/topic/photoswipe/photoswipe-lightbox.esm.min.js +5 -0
- package/dist/spa/topic/photoswipe/photoswipe.css +420 -0
- package/dist/spa/topic/photoswipe/photoswipe.esm.js +7081 -0
- package/dist/spa/topic/photoswipe/photoswipe.esm.js.map +1 -0
- package/dist/spa/topic/photoswipe/photoswipe.esm.min.js +5 -0
- package/dist/style.css +1 -1
- package/dist/types/components/Designer.vue.d.ts +2 -0
- package/package.json +1 -1
@@ -0,0 +1,32 @@
|
|
1
|
+
import PhotoSwipe from '../photoswipe/photoswipe.esm.min.js';
|
2
|
+
|
3
|
+
$(function () {
|
4
|
+
// 获取所有的 gp-designer-image-preview 的 data-preview 属性的值
|
5
|
+
const previews = $('.gp-designer-image-preview').map(function () {
|
6
|
+
return $(this).data('preview');
|
7
|
+
}).get();
|
8
|
+
const dataSource = previews.map(c => {
|
9
|
+
return {
|
10
|
+
src: c,
|
11
|
+
width: 360,
|
12
|
+
height: 360
|
13
|
+
}
|
14
|
+
});
|
15
|
+
const options = { dataSource };
|
16
|
+
|
17
|
+
// 图片预览
|
18
|
+
$('.gp-designer-image-preview').on('click', function () {
|
19
|
+
if (!PhotoSwipe || previews.length === 0) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
const preview = $(this).data('preview');
|
23
|
+
options.index = previews.indexOf(preview);
|
24
|
+
const pswp = new PhotoSwipe(options);
|
25
|
+
pswp.init();
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|