File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/BootstrapBlazor.Server/Components/Samples Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1717 <Button Text =" @Localizer[" ImageCropperDisabledText " ]" OnClick =" _cropper.Disable" />
1818 <Button Text =" @Localizer[" ImageCropperClearText " ]" OnClick =" _cropper.Clear" />
1919 </BootstrapInputGroup >
20- <Textarea Value =" @_base64String" rows =" 3" class =" mt-3" />
20+ @if (! string .IsNullOrEmpty (_base64String ))
21+ {
22+ <img src =" @_base64String" style =" width : 240px ;" />
23+ <Textarea Value =" @_base64String" rows =" 3" class =" mt-3" />
24+ }
2125 </section >
2226</DemoBlock >
2327
2428<DemoBlock Title =" @Localizer[" ImageCropperNormalText " ]" Introduction =" @Localizer[" ImageCropperNormalIntro " ]" Name =" Normal" >
25- <ImageCropper Url =" @images[0]" CropperShape =" ImageCropperShape.Round" />
29+ <ImageCropper Url =" @images[0]" CropperShape =" ImageCropperShape.Round" OnCropAsync =" OnCropAsync" />
30+ @if (! string .IsNullOrEmpty (_base64String2 ))
31+ {
32+ <img src =" @_base64String2" style =" width : 240px ;" />
33+ }
2634</DemoBlock >
2735
2836<AttributeTable Items =" @GetAttributes()" />
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ public partial class ImageCroppers
1717
1818 private string ? _base64String ;
1919
20+ private string ? _base64String2 ;
21+
2022 private async Task OnClickReplace ( )
2123 {
2224 index = index == 0 ? 1 : 0 ;
@@ -28,6 +30,13 @@ private async Task Crop()
2830 _base64String = await _cropper . Crop ( ) ;
2931 }
3032
33+ private Task OnCropAsync ( ImageCropperResult result )
34+ {
35+ _base64String2 = result . Data ;
36+ StateHasChanged ( ) ;
37+ return Task . CompletedTask ;
38+ }
39+
3140 private Task Rotate ( ) => _cropper . Rotate ( 90 ) ;
3241
3342 /// <summary>
You can’t perform that action at this time.
0 commit comments