File tree 1 file changed +31
-4
lines changed
1 file changed +31
-4
lines changed Original file line number Diff line number Diff line change 80
80
' showAutocomplete' : {
81
81
type: Boolean ,
82
82
default: true
83
+ },
84
+ ' suggestOnAllWords' : {
85
+ type: Boolean ,
86
+ default: false
83
87
}
84
88
},
85
89
data () {
384
388
this .placeholderVal === ' ' && this .highlightedIndex !== 0
385
389
},
386
390
isSimilar (o ) {
387
- if (o) {
388
- return o[this .suggestionAttribute ]
389
- .toLowerCase ()
390
- .startsWith (this .textVal .toLowerCase ())
391
+ if (o) {
392
+ if ( this .suggestOnAllWords ) {
393
+ var isMatch = false ;
394
+ var words = o[this .suggestionAttribute ].split (" " );
395
+ var textValWords = this .textVal .split (" " );
396
+ if ( words .length > 0 ) {
397
+ words .forEach (function (word ) {
398
+ if ( textValWords .length > 0 ) {
399
+ textValWords .forEach (function (textValWord ) {
400
+ if (word .toLowerCase ().startsWith (textValWord .toLowerCase ())) {
401
+ isMatch = true ;
402
+ }
403
+ });
404
+ }
405
+ else if (word .toLowerCase ().startsWith (this .textVal .toLowerCase ())) {
406
+ isMatch = true ;
407
+ }
408
+ });
409
+ return isMatch;
410
+ }
411
+ }
412
+
413
+ return o[this .suggestionAttribute ]
414
+ .toLowerCase ()
415
+ .startsWith (this .textVal .toLowerCase ())
416
+
417
+
391
418
}
392
419
},
393
420
isSameType (o ) {
You can’t perform that action at this time.
0 commit comments