mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-11-29 18:48:50 +08:00
fix(module: image): disables previewing error images and hides buttons when there is only one image (#1060)
This commit is contained in:
parent
def6eca435
commit
2b82f3bdbd
@ -94,9 +94,10 @@ namespace AntDesign
|
||||
|
||||
private void HandleOnError()
|
||||
{
|
||||
Src = Fallback;
|
||||
|
||||
_loaded = true;
|
||||
_isError = true;
|
||||
Src = Fallback;
|
||||
}
|
||||
|
||||
private void HandleOnLoad()
|
||||
|
@ -21,10 +21,13 @@
|
||||
<div class="ant-image-preview-img-wrapper" style="transform: translate3d(0px, 0px, 0px);">
|
||||
<img class="ant-image-preview-img" src="@ImageRef.ImageSrc" style="transform: scale3d(@_zoomOutTimes, @_zoomOutTimes, 1) rotate(@(90*_rotateTimes)deg);">
|
||||
</div>
|
||||
<div class="ant-image-preview-switch-left @(ImageRef.CurrentIndex==0?"ant-image-preview-switch-left-disabled":"")" @onclick="()=>ImageRef.SwitchTo(ImageRef.CurrentIndex-1)" @onclick:stopPropagation>
|
||||
<Icon Type="left" />
|
||||
</div>
|
||||
<div class="ant-image-preview-switch-right @(ImageRef.CurrentIndex==ImageRef.ImageCount-1?"ant-image-preview-switch-right-disabled":"")" @onclick="()=>ImageRef.SwitchTo(ImageRef.CurrentIndex+1)" @onclick:stopPropagation>
|
||||
<Icon Type="right" />
|
||||
</div>
|
||||
@if (ImageRef.ImageCount > 1)
|
||||
{
|
||||
<div class="ant-image-preview-switch-left @(ImageRef.CurrentIndex==0?"ant-image-preview-switch-left-disabled":"")" @onclick="()=>ImageRef.SwitchTo(ImageRef.CurrentIndex-1)" @onclick:stopPropagation>
|
||||
<Icon Type="left" />
|
||||
</div>
|
||||
<div class="ant-image-preview-switch-right @(ImageRef.CurrentIndex==ImageRef.ImageCount-1?"ant-image-preview-switch-right-disabled":"")" @onclick="()=>ImageRef.SwitchTo(ImageRef.CurrentIndex+1)" @onclick:stopPropagation>
|
||||
<Icon Type="right" />
|
||||
</div>
|
||||
}
|
||||
</Dialog>
|
@ -8,9 +8,6 @@ namespace AntDesign
|
||||
[Parameter]
|
||||
public ImageRef ImageRef { get; set; }
|
||||
|
||||
[Inject]
|
||||
private ImageService ImageService { get; set; }
|
||||
|
||||
private int _zoomOutTimes = 1;
|
||||
private int _rotateTimes;
|
||||
private bool _visible = true;
|
||||
@ -21,7 +18,8 @@ namespace AntDesign
|
||||
StateHasChanged();
|
||||
// Blocking DOM removal
|
||||
await Task.Delay(200);
|
||||
ImageService.CloseImage(ImageRef);
|
||||
|
||||
ImageRef.Close();
|
||||
}
|
||||
|
||||
private void HandleZoomIn()
|
||||
|
@ -10,9 +10,6 @@ namespace AntDesign
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
[Inject]
|
||||
private ImageService ImageService { get; set; }
|
||||
|
||||
internal IList<Image> Images => _images;
|
||||
|
||||
private IList<Image> _images;
|
||||
|
Loading…
Reference in New Issue
Block a user