0

我正在尝试使用“nativescript-photo-zoom”和nativescript-image-zoom 在我的角度应用程序中进行图像缩放,但它抛出“PhotoDraweeView 不是构造函数错误”有人可以帮助我吗?

我的代码html:

    <PhotoZoom [src]="photoUrl" (finalImageSet)="onFinalImageSet($event)" (failure)="onFailure($event)"  (scaleChanged)="onScaleChanged($event)"></PhotoZoom> 
    </GridLayout>

ts:

@Component({ selector: "ns-details", moduleId: module.id, templateUrl: "./item-detail.component.html", }) 导出类 ItemDetailComponent 实现 OnInit {

public photoUrl="https:// vignette.wikia.nocookie.net/inuyasha/images/b/b5/ Inuyasha.png";

constructor() { }

ngOnInit(): void {
    const id = +this.route.snapshot.params["id"];
    this.item = this.itemService.getItem(id);
}

onFinalImageSet(event) {
    console.log("onFinalImageSet: ", event);
}

onFailure(event) {
    console.log("onFailure: ", event);
}

onScaleChanged(event) {
    console.log("onScaleChanged: ", event.object.zoomScale);
}

}

应用程序模块

从“nativescript-photo-zoom/angular”导入 { NativeScriptUIPhotoZoomModule };

@NgModule({

imports: [
    NativeScriptModule,
    AppRoutingModule,
    NativeScriptUIPhotoZoomModule
],

})

导出类 AppModule { }

4

1 回答 1

0

尝试使用ng-img-magnifier npm 包。这是一个有效的演示。非常易于实施且完全可定制。

<ng-img-magnifier [thumbImage]='img' [fullImage]='img2'
    [top]='top' [right]='right'
    [lensWidth]='lensewidth' [lensHeight]='lensheight'
    [resultWidth]='resultWidth' [resultHeight]='resultheight'
    [imgWidth]='imgWidth' [imgHeight]='imgheight'>
</ng-img-magnifier>
于 2021-05-23T17:46:23.577 回答