From 1eb80784fe2b80be0273d421b7c6c1ae327ba393 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 10 Sep 2020 11:03:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E6=96=B0=E5=A2=9E=E5=92=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=BE=E7=89=87=E5=90=8E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?viewer.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/collection-tools/collection-tools.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index 27c4868..64541e1 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -65,11 +65,13 @@ export class CollectionToolsComponent implements OnInit { canvasAssetObj //传入的素材属性对象 isImgNumCss = false //控制上传文件input显隐 mySwiper:any //轮播图实例 + + gallery setAssetsProperty(obj){ setTimeout(() => { obj.PropertyInfos.forEach(item => { if(item.PropertyType == 4){ - let gallery = new Viewer(document.getElementById('viewerjs'),{ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ url: 'data-original' }); } @@ -314,6 +316,7 @@ export class CollectionToolsComponent implements OnInit { this.imagesArr.push(imgObj) this.canvasAssetObj.PropertyInfos.push(imgObj) + setTimeout(() => { this.mySwiper = new Swiper('.swiper-container',{ loop: false, @@ -330,9 +333,8 @@ export class CollectionToolsComponent implements OnInit { } }); - // this.mySwiper.update() this.mySwiper.slideTo(this.imagesArr.length - 1) - + this.gallery.update() }, 0); //判断上传素材属性图片是否超出数量 超出数量则隐藏input框 @@ -378,6 +380,7 @@ export class CollectionToolsComponent implements OnInit { //更新swiper视图 setTimeout(() => { this.mySwiper.update(); + this.gallery.update() }, 0); this.canvasData.isChange = true