mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
docs(fuse): fix fuse.js example (#1229)
This commit is contained in:
@@ -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>
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"date-fns": "^2.11.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"fuse.js": "^5.1.0",
|
||||
"fuse.js": "^6.4.0",
|
||||
"gh-pages": "^2.2.0",
|
||||
"node-sass": "^4.12.0",
|
||||
"octonode": "^0.9.5",
|
||||
|
||||
+4
-4
@@ -3734,10 +3734,10 @@ function-bind@^1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
|
||||
|
||||
fuse.js@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-5.1.0.tgz#192a670e48bc3ac0247cf9a61590714ab991f7a8"
|
||||
integrity sha512-R8nPr9tQx0HdjRJsqkESimL7o/2Xe0/Lw0cMBrBjkAKAJFq6D6u/o3obteqxkvOJNEgS4xPP78dxoNMaCWNoGg==
|
||||
fuse.js@^6.4.0:
|
||||
version "6.4.0"
|
||||
resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-6.4.0.tgz#a8db8b1c301cdb313f2ebb6812b31aa7dc2a6a14"
|
||||
integrity sha512-MagWS1i3kj58BgF9xymo+n2ZiSs9MoyVfxkCcr11+mzMpNEyTDyLtbU3DyrVjHsy0Gkjf58FH1n+TaihylFcIA==
|
||||
|
||||
gauge@~2.7.3:
|
||||
version "2.7.4"
|
||||
|
||||
Reference in New Issue
Block a user