Skip to content

Commit

Permalink
Merge pull request #9 from tomieric/feature-props-fuse-options
Browse files Browse the repository at this point in the history
Feat(Fuse):#8 support fuse options
  • Loading branch information
xiaoluoboding authored Dec 14, 2022
2 parents 4075cc3 + d05b418 commit 868d37f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/Command.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ const SELECTED_ITEM_SELECTOR = `${ITEM_SELECTOR}[aria-selected="true"]`
const SELECT_EVENT = `command-item-select`
const VALUE_ATTR = `data-value`
const fuseOptions = {
threshold: 0.2,
keys: ['label']
}
const props = defineProps({
theme: {
type: String,
default: 'default'
},
fuseOptions: {
type: Object,
default: () => ({
threshold: 0.2,
keys: ['label']
})
}
})
Expand Down Expand Up @@ -78,8 +80,8 @@ const commandFuseList = computed(() => {
})
const fuse = computed(() => {
const fuseIndex = Fuse.createIndex(fuseOptions.keys, commandFuseList.value)
return new Fuse(commandFuseList.value, fuseOptions, fuseIndex)
const fuseIndex = Fuse.createIndex(props.fuseOptions.keys, commandFuseList.value)
return new Fuse(commandFuseList.value, props.fuseOptions, fuseIndex)
})
const scrollSelectedIntoView = () => {
Expand Down

1 comment on commit 868d37f

@vercel
Copy link

@vercel vercel bot commented on 868d37f Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue-command-palette – ./

vue-command-palette-git-main-xlbd.vercel.app
vue-command-palette.vercel.app
vue-command-palette-xlbd.vercel.app

Please sign in to comment.