File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 11import { SuperComponent , wxComponent } from '../common/src/index' ;
2+ import { isDef } from '../common/validator' ;
23import config from '../common/config' ;
34import props from './props' ;
45
@@ -150,19 +151,15 @@ export default class TreeSelect extends SuperComponent {
150151 handleChange ( e ) {
151152 const { innerValue } = this . data ;
152153 const { level, type } = e . target . dataset ;
154+ const { value } = type === 'multiple' ? e . detail . context : e . detail ;
153155
154156 if ( type === 'multiple' ) {
155- const {
156- context : { value } ,
157- } = e . detail ;
158- const index = innerValue [ level ] . indexOf ( value ) ;
159- if ( index !== - 1 ) {
160- innerValue [ level ] . splice ( index , 1 ) ;
161- } else {
162- innerValue [ level ] . push ( value ) ;
157+ if ( ! isDef ( innerValue [ level ] ) ) {
158+ innerValue [ level ] = [ ] ;
163159 }
160+ const index = innerValue [ level ] . indexOf ( value ) ;
161+ index === - 1 ? innerValue [ level ] . push ( value ) : innerValue [ level ] . splice ( index , 1 ) ;
164162 } else {
165- const { value } = e . detail ;
166163 innerValue [ level ] = value ;
167164 }
168165
You can’t perform that action at this time.
0 commit comments