mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-07 07:12:23 +03:00
rename filterMatch to filterBy
This commit is contained in:
@@ -585,7 +585,7 @@
|
||||
* @param {String} search
|
||||
* @return {Boolean}
|
||||
*/
|
||||
filterMatch: {
|
||||
filterBy: {
|
||||
type: Function,
|
||||
default(option, label, search) {
|
||||
return (label || '').toLowerCase().indexOf(search.toLowerCase()) > -1
|
||||
@@ -596,7 +596,7 @@
|
||||
* Callback to filter results when search text
|
||||
* is provided. Default implementation loops
|
||||
* each option, and returns the result of
|
||||
* this.filterMatch.
|
||||
* this.filterBy.
|
||||
* @type {Function}
|
||||
* @param {Array} list of options
|
||||
* @param {String} search text
|
||||
@@ -611,7 +611,7 @@
|
||||
if (typeof label === 'number') {
|
||||
label = label.toString()
|
||||
}
|
||||
return this.filterMatch(option, label, search)
|
||||
return this.filterBy(option, label, search)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -324,7 +324,7 @@ describe('Select.vue', () => {
|
||||
|
||||
it('can determine if a given option should match the current search text', () => {
|
||||
const vm = new Vue({
|
||||
template: `<div><v-select ref="select" :filter-match="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`,
|
||||
template: `<div><v-select ref="select" :filter-by="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`,
|
||||
data: {value: 'foo'},
|
||||
methods:{
|
||||
customFn: (option, label, search) => label.match(new RegExp('^' + search, 'i'))
|
||||
|
||||
Reference in New Issue
Block a user