chore(docs): add ContextMenu component page (#128)

This commit is contained in:
Sylvain Marroufin
2023-02-22 12:31:08 +01:00
committed by GitHub
parent 7970aefcb0
commit 63e27f8b4b
4 changed files with 60 additions and 6 deletions

View File

@@ -133,7 +133,7 @@
Context menu:
</div>
<UCard ref="contextMenuRef" class="relative" body-class="h-64" @click="isContextMenuOpen = false" @contextmenu.prevent="openContextMenu">
<UCard class="relative" body-class="h-64" @click="isContextMenuOpen = false" @contextmenu.prevent="openContextMenu">
<UContextMenu v-model="isContextMenuOpen" :virtual-element="virtualElement" width-class="w-48">
<UCard @click.stop>
Menu
@@ -256,7 +256,7 @@ const { $toast } = useNuxtApp()
const x = ref(0)
const y = ref(0)
const isContextMenuOpen = ref(false)
const contextMenuRef = ref(null)
const virtualElement = ref({ getBoundingClientRect: () => ({}) })
const commandPaletteGroups = computed(() => ([{
key: 'people',
@@ -277,8 +277,6 @@ onMounted(() => {
})
})
const virtualElement = ref({ getBoundingClientRect: () => ({}) })
function openContextMenu () {
const top = unref(y)
const left = unref(x)