大家好,我从服务器端得到一张图片,并在网站上显示。当按下下载按钮时,我想下载它。我如何实现这一点?
我有如下的html
<div class="row SectionRow" style="margin: 50px 0px !important;">
<div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center; margin-bottom: 20px">
<img #imgRef2 class="ProfileImage">
<br>
<button type="button" (click)="DownloadProfilePic()" class="btn btn-default SigButton">Download</button>
</div>
<div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center; margin-bottom: 20px; padding-top: 50px;">
<img #imgRef class="SignatureImage">
<br>
<button type="button" class="btn btn-default SigButton">Download</button>
</div>
</div>
角字体
@ViewChild('imgRef') Signature: ElementRef;
@ViewChild('imgRef2') ProfilePic: ElementRef;
OnInit()
{
this.Signature.nativeElement.src = this.ImageAppDetails.AA_SIGNATURE;
this.ProfilePic.nativeElement.src = this.ImageAppDetails.AA_PHOTO;
}
该url将用于配置文件pic'
http://192.0.0.100/image.jpg
当我点击下载按钮时,如何实现这一点。我们将不胜感激。