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>
@@ -112,11 +110,11 @@ private void ResetValue()
112110
113111 private async Task OnClearValue ( )
114112 {
115- _provinceValue = "" ;
116- _cityValue = "" ;
113+ _provinceValue = null ;
114+ _cityValue = null ;
117115 _countyValue = new ( ) ;
118- _detailValue = "" ;
119- CurrentValue = "" ;
116+ _detailValue = null ;
117+ CurrentValue = null ;
120118
121119 _currentViewMode = RegionViewMode . Province ;
122120
@@ -161,6 +159,9 @@ private HashSet<string> GetDetails()
161159 private void OnClickProvince ( string value )
162160 {
163161 _provinceValue = value ;
162+ _cityValue = null ;
163+ _countyValue = new ( ) ;
164+ _detailValue = null ;
164165 _currentViewMode = RegionViewMode . City ;
165166
166167 CurrentValue = _provinceValue ;
@@ -169,6 +170,8 @@ private void OnClickProvince(string value)
169170 private void OnClickCity ( string value )
170171 {
171172 _cityValue = value ;
173+ _countyValue = new ( ) ;
174+ _detailValue = null ;
172175 _currentViewMode = RegionViewMode . County ;
173176
174177 CurrentValue = $ "{ _provinceValue } -{ _cityValue } ";
@@ -177,6 +180,7 @@ private void OnClickCity(string value)
177180 private void OnClickCounty ( CountyItem item )
178181 {
179182 _countyValue = item ;
183+ _detailValue = null ;
180184 _currentViewMode = RegionViewMode . Detail ;
181185
182186 CurrentValue = $ "{ _provinceValue } -{ _cityValue } -{ _countyValue . Name } ";
@@ -194,22 +198,16 @@ private async Task OnClickDetail(string value)
194198 private void OnSwitchProvinceView ( )
195199 {
196200 _currentViewMode = RegionViewMode . Province ;
197- _cityValue = "" ;
198- _countyValue = new ( ) ;
199- _detailValue = "" ;
200201 }
201202
202203 private void OnSwitchCityView ( )
203204 {
204205 _currentViewMode = RegionViewMode . City ;
205- _countyValue = new ( ) ;
206- _detailValue = "" ;
207206 }
208207
209208 private void OnSwitchCountyView ( )
210209 {
211210 _currentViewMode = RegionViewMode . County ;
212- _detailValue = "" ;
213211 }
214212
215213 private void OnSwitchDetailView ( )
0 commit comments