File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 75
75
< v-select placeholder ="filtering with fuse.js " label ="title " :options ="fuseSearchOptions " :filter ="fuseSearch ">
76
76
< template slot ="option " scope ="option ">
77
77
< strong > {{ option.title }}</ strong > < br >
78
- < em > {{ `${ option.author.firstName} ${ option.author.lastName}` }}</ em >
78
+ < em > {{ option.author.firstName + ' ' + option.author.lastName }}</ em >
79
79
</ template >
80
80
</ v-select >
81
+ < v-select placeholder ="Vue select with no options and a custom no-option span " >
82
+ < span slot ="no-options "> Custom no options message</ span >
83
+ </ v-select >
81
84
</ div >
82
85
</ body >
83
86
Original file line number Diff line number Diff line change 917
917
isOptionSelected (option ) {
918
918
let selected = false
919
919
this .valueAsArray .forEach (value => {
920
- if (typeof value === ' object' ) {
921
- selected = this . optionObjectComparator (value, option)
920
+ if (typeof value === ' object' && this . optionObjectComparator (value, option) ) {
921
+ selected = true
922
922
} else if (value === option || value === option[this .index ]) {
923
923
selected = true
924
924
}
986
986
if (this .clearSearchOnBlur ) {
987
987
this .search = ' '
988
988
}
989
- this .open = false
990
- this .$emit (' search:blur' )
989
+ this .closeSearchOptions ()
990
+ return
991
+ }
992
+ // Fixed bug where no-options message could not be closed
993
+ if (this .search .length === 0 && this .options .length === 0 ){
994
+ this .closeSearchOptions ()
995
+ return
991
996
}
992
997
},
993
998
999
+ /**
1000
+ * 'Private' function to close the search options
1001
+ * @emits {search:blur}
1002
+ * @returns {void}
1003
+ */
1004
+ closeSearchOptions (){
1005
+ this .open = false
1006
+ this .$emit (' search:blur' )
1007
+ },
1008
+
994
1009
/**
995
1010
* Open the dropdown on focus.
996
1011
* @emits {search:focus}
You can’t perform that action at this time.
0 commit comments