Skip to content

Commit

Permalink
fix(example): use key instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Kirchhoff committed Oct 18, 2024
1 parent 886108f commit f69c557
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/examples/basic/src/components/CmdBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,28 @@ async function fetchProducts() {
const actions = [
{
id: 'new-resource',
key: 'new-resource',
label: 'Create new Resource',
leading: './src/assets/icons/create.svg',
action: () => alert('New Resource created'),
shortcut: 'Ctrl+R'
},
{
id: 'new-service',
key: 'new-service',
label: 'Add new Service',
leading: './src/assets/icons/service_1.svg',
action: () => alert('New Service added'),
shortcut: 'Ctrl+S'
},
{
id: 'open-settings',
key: 'open-settings',
label: 'Open settings',
leading: './src/assets/icons/settings.svg',
action: () => alert('Settings opened'),
shortcut: 'Ctrl+,'
},
{
id: 'open-calendar',
key: 'open-calendar',
label: 'Open calendar',
leading: './src/assets/icons/calendar.svg',
action: () => alert('Calendar opened'),
Expand Down Expand Up @@ -167,6 +167,7 @@ const groups = computed(() =>
const { emitter } = useCmdBarEvent()
emitter.on('selected', (command) => {
console.log("🚀 ~ emitter.on ~ command:", command)
activeCommand.value = command
})
Expand Down Expand Up @@ -201,6 +202,7 @@ onMounted(() => {
fetchUsers()
fetchProducts()
})
</script>

<template>
Expand Down Expand Up @@ -235,6 +237,9 @@ onMounted(() => {
<template #no-results>
<div class="no-results">No results found !!!</div>
</template>
<template #preview="{activeCommand}">
<span>{{ activeCommand?.label }}</span>
</template>
</CmdBarList>
</template>
<template #footer>
Expand Down

0 comments on commit f69c557

Please sign in to comment.