2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-07 07:12:23 +03:00

Add option to disable filtering options by the search text

If the filtering is done on the server-side or the search text isn't
contained in the option text then this should be set to `false`.
This commit is contained in:
Daniel Lohse
2017-12-05 18:12:36 +01:00
parent 70b6c1289a
commit 2bf2661405
+13
View File
@@ -504,6 +504,16 @@
default: false
},
/**
* When true, existing options will be filtered
* by the search text.
* @type {Boolean}
*/
filterOptions: {
type: Boolean,
default: true
},
/**
* User defined function for adding Options
* @type {Function}
@@ -887,6 +897,9 @@
* @return {array}
*/
filteredOptions() {
if (this.filterOptions === false) {
return this.mutableOptions
}
let options = this.mutableOptions.filter((option) => {
if (typeof option === 'object' && option.hasOwnProperty(this.label)) {
return option[this.label].toLowerCase().indexOf(this.search.toLowerCase()) > -1