@@ -273,7 +273,7 @@ const SearchItem = {
273273 return this . search_filter != '' ;
274274 } ,
275275 currentField ( ) {
276- let field = this . fields && this . search_filter ? this . fields [ this . search_filter ] : null ;
276+ let field = this . fields && this . search_filter && this . fields . hasOwnProperty ( this . search_filter ) ? this . fields [ this . search_filter ] : null ;
277277 let localField = { index : this . index , condition : this . condition , value : this . value , field : field } ;
278278 return field ? { ...field , ...localField } : localField ;
279279 } ,
@@ -656,21 +656,38 @@ const SearchSelectMultiple = {
656656 template : "#search-input-multiple-template" ,
657657 props : [ 'index' , 'value' , 'field' ] ,
658658 data ( ) {
659- let value = '' ;
660- if ( this . value != null && this . value != undefined ) {
661- value = this . value . value ;
659+ let currentValue = [ ] ;
660+ if ( this . value && Array . isArray ( this . value ) && this . value . length > 0 ) {
661+ currentValue = this . value . map ( item => item . value ) ;
662662 }
663+
663664 return {
664- currentValue : value ,
665+ currentValue : currentValue ,
665666 options : this . field . options || { } ,
666667 empty : this . field . empty || '[Select]' ,
667668 } ;
668669 } ,
669670 methods : {
670671 setValue ( event ) {
671- this . $emit ( 'change-value' , { index : this . index , value : { value : this . currentValue } } ) ;
672+ const valueObjects = this . currentValue . map ( value => ( { value } ) ) ;
673+ this . $emit ( 'change-value' , {
674+ index : this . index ,
675+ value : { value : valueObjects }
676+ } ) ;
672677 } ,
673678 } ,
679+ watch : {
680+ value : {
681+ handler ( newValue ) {
682+ if ( newValue ?. value ) {
683+ this . currentValue = newValue . value . map ( item => item . value ) ;
684+ } else {
685+ this . currentValue = [ ] ;
686+ }
687+ } ,
688+ deep : true
689+ }
690+ }
674691} ;
675692
676693const SearchMultiple = {
0 commit comments