Skip to content

Instantly share code, notes, and snippets.

@ilvalerione
Last active May 2, 2023 07:37
Show Gist options
  • Save ilvalerione/f7b84c1bd1e8baf686231ae62dc8470a to your computer and use it in GitHub Desktop.
Save ilvalerione/f7b84c1bd1e8baf686231ae62dc8470a to your computer and use it in GitHub Desktop.
Programmatically open commandbar
<template>
<div class="row p-3 align-items-center bg-white">
<div class="col">
<span class="text-muted pointer" @click="openCommandBar">
<i class="bi bi-search me-3"></i>
Search for help
</span>
</div>
<div class="col-auto">
<!-- User profile -->
</div>
</div>
</template>
<script>
import { init } from 'commandbar';
init('xxxxxxxx');
export default {
mounted() {
window.CommandBar.boot('123')
.then(() => console.log('CommandBar booted for user '+window.user.id));
},
methods: {
openCommandBar() {
console.log('Trying to open CommandBar', window.CommandBar);
window.CommandBar.open();
},
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment