Last active
May 2, 2023 07:37
-
-
Save ilvalerione/f7b84c1bd1e8baf686231ae62dc8470a to your computer and use it in GitHub Desktop.
Programmatically open commandbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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