2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

docs(fuse): fix fuse.js example (#1229)

This commit is contained in:
Jeff Sagal
2020-07-09 09:43:47 -07:00
committed by GitHub
parent 1b3294319a
commit 4360f00137
3 changed files with 19 additions and 19 deletions
+14 -14
View File
@@ -1,31 +1,31 @@
<template>
<v-select :filter="fuseSearch" :options="books" :getOptionLabel="option => option.title">
<template #option="{author, title}">
{{ title }} <br>
<template #option="{ author, title }">
{{ title }}
<br />
<cite>{{ author.firstName }} {{ author.lastName }}</cite>
</template>
</v-select>
</template>
<script>
import Fuse from 'fuse.js';
import books from '../data/books';
import Fuse from "fuse.js";
import books from "../data/books";
export default {
computed: {
books: () => books,
books: () => books
},
methods: {
fuseSearch (options, search) {
fuseSearch(options, search) {
const fuse = new Fuse(options, {
keys: ['title', 'author.firstName', 'author.lastName'],
shouldSort: true,
keys: ["title", "author.firstName", "author.lastName"],
shouldSort: true
});
return search.length ? fuse.search(search) : fuse.list;
},
},
return search.length
? fuse.search(search).map(({ item }) => item)
: fuse.list;
}
}
};
</script>
<style scoped>
</style>