LightBox不在8号角显示图像

问题描述 投票:0回答:1

在我的申请中,我添加:

"@ngx-gallery/core": "^4.0.3",
"@ngx-gallery/gallerize": "^4.0.3",
"@ngx-gallery/lightbox": "^4.0.3",

我从API读取了图像列表,并将其作为ImageItem列表放在this.items中,但是在页面灯箱中不起作用!这是我在ts中的方法:

GetGallery() {
  this.onlineSaleService.GetGalleryImages().subscribe((data: any[]) => {
    debugger;

    this.items = data['Result'].map(item => new ImageItem({ src:this.root+item.ImageName, thumb: this.root+item.ImageName,textProperty:item.Title }));
    this.galleryItem=data['Result'];
    const lightboxRef = this.gallery.ref('lightbox');
    lightboxRef.setConfig({
      imageSize: ImageSize.Cover,
      thumbPosition: ThumbnailsPosition.Top
    });

    lightboxRef.load(this.items);
  });
}

这是我的html代码:

<a  (click)="lightbox.open(0)"> gallery</a>

这是调试器中的结果:

enter image description here

这是结果:

enter image description here

这是package.json代码:

{
  "name": "xelle-ui",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.13",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.2.8",
    "@angular/compiler": "~8.2.8",
    "@angular/core": "~8.2.8",
    "@angular/forms": "~8.2.8",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "~8.2.8",
    "@angular/platform-browser-dynamic": "~8.2.8",
    "@angular/router": "~8.2.8",
    "@ngx-gallery/core": "^4.0.3",
    "@ngx-gallery/gallerize": "^4.0.3",
    "@ngx-gallery/lightbox": "^4.0.3",
    "@types/jquery": "^3.3.31",
    "angular-bootstrap-lightbox": "^0.12.0",
    "angular-material": "^1.1.20",
    "core-js": "^2.5.7",
    "datatables.net": "^1.10.20",
    "hammerjs": "^2.0.8",
    "ngx-gallery": "^5.10.0",
    "rxjs": "~6.4.0",
    "sweetalert2": "^8.18.6",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.6",
    "@angular/cli": "~8.3.6",
    "@angular/compiler-cli": "~8.2.8",
    "@angular/language-service": "~8.2.8",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }
}
angular lightbox angular8
1个回答
0
投票

最终我阅读了文档并找到了解决方法:

    lightboxRef.setConfig({
  loadingMode: 'indeterminate', 
});

确定将显示图像加载进度(它使用HttpClient下载图像)。不确定将使用本机加载程序。enter link description here

© www.soinside.com 2019 - 2024. All rights reserved.