22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33// Website: https://www.blazor.zone or https://argozhang.github.io/
44
5- using Microsoft . AspNetCore . Components ;
6-
75namespace BootstrapBlazor . Components ;
86
97/// <summary>
@@ -177,11 +175,11 @@ private void ResetValue()
177175
178176 private async Task OnClearValue ( )
179177 {
180- _provinceValue = "" ;
181- _cityValue = "" ;
178+ _provinceValue = null ;
179+ _cityValue = null ;
182180 _countyValue = new ( ) ;
183- _detailValue = "" ;
184- CurrentValue = "" ;
181+ _detailValue = null ;
182+ CurrentValue = null ;
185183
186184 _currentViewMode = RegionViewMode . Province ;
187185
@@ -226,6 +224,9 @@ private HashSet<string> GetDetails()
226224 private void OnClickProvince ( string value )
227225 {
228226 _provinceValue = value ;
227+ _cityValue = null ;
228+ _countyValue = new ( ) ;
229+ _detailValue = null ;
229230 _currentViewMode = RegionViewMode . City ;
230231
231232 CurrentValue = _provinceValue ;
@@ -234,6 +235,8 @@ private void OnClickProvince(string value)
234235 private void OnClickCity ( string value )
235236 {
236237 _cityValue = value ;
238+ _countyValue = new ( ) ;
239+ _detailValue = null ;
237240 _currentViewMode = RegionViewMode . County ;
238241
239242 CurrentValue = $ "{ _provinceValue } -{ _cityValue } ";
@@ -242,6 +245,7 @@ private void OnClickCity(string value)
242245 private void OnClickCounty ( CountyItem item )
243246 {
244247 _countyValue = item ;
248+ _detailValue = null ;
245249 _currentViewMode = RegionViewMode . Detail ;
246250
247251 CurrentValue = $ "{ _provinceValue } -{ _cityValue } -{ _countyValue . Name } ";
@@ -259,22 +263,16 @@ private async Task OnClickDetail(string value)
259263 private void OnSwitchProvinceView ( )
260264 {
261265 _currentViewMode = RegionViewMode . Province ;
262- _cityValue = "" ;
263- _countyValue = new ( ) ;
264- _detailValue = "" ;
265266 }
266267
267268 private void OnSwitchCityView ( )
268269 {
269270 _currentViewMode = RegionViewMode . City ;
270- _countyValue = new ( ) ;
271- _detailValue = "" ;
272271 }
273272
274273 private void OnSwitchCountyView ( )
275274 {
276275 _currentViewMode = RegionViewMode . County ;
277- _detailValue = "" ;
278276 }
279277
280278 private void OnSwitchDetailView ( )
0 commit comments