File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
src/BootstrapBlazor/Components/Upload Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,6 @@ public partial class AvatarUpload<TValue>
8585 . AddClass ( GetValidStatus ( item ) )
8686 . Build ( ) ;
8787
88- private string ? GetValidStatus ( UploadFile ? item = null )
89- {
90- if ( item == null || IsDisabled || ValidateForm == null )
91- {
92- return null ;
93- }
94-
95- var state = item . IsValid ;
96- return state . HasValue
97- ? state . Value ? "is-valid" : "is-invalid"
98- : null ;
99- }
100-
10188 /// <summary>
10289 /// 获得/设置 预览框 Style 属性
10390 /// </summary>
@@ -136,7 +123,6 @@ protected override void OnParametersSet()
136123 // 头像上传时如果用户没有设置 OnChanged 回调,需要使用内置方法将文件头像转化未 Base64 格式用于预览
137124 OnChange ??= async item =>
138125 {
139- item . ValidateId = $ "{ Id } _{ item . GetHashCode ( ) } ";
140126 await item . RequestBase64ImageFileAsync ( ) ;
141127 } ;
142128 }
@@ -151,4 +137,17 @@ protected override void OnParametersSet()
151137 }
152138
153139 private string ? AddId => Files . Count == 0 ? $ "{ Id } _new" : null ;
140+
141+ private string ? GetValidStatus ( UploadFile ? item = null )
142+ {
143+ if ( item == null || IsDisabled || ValidateForm == null )
144+ {
145+ return null ;
146+ }
147+
148+ var state = item . IsValid ;
149+ return state . HasValue
150+ ? state . Value ? "is-valid" : "is-invalid"
151+ : null ;
152+ }
154153}
You can’t perform that action at this time.
0 commit comments