diff --git a/docs/pages/examples.vue b/docs/pages/examples.vue index baf704e4..2c0ccc8f 100644 --- a/docs/pages/examples.vue +++ b/docs/pages/examples.vue @@ -170,7 +170,7 @@ Context menu: - + Menu @@ -292,19 +292,20 @@ onMounted(() => { }) }) -const virtualElement = computed(() => ({ - getBoundingClientRect () { - return { - width: 0, - height: 0, - top: y.value, - right: x.value, - bottom: y.value, - left: x.value - } - }, - contextElement: contextMenuRef.value?.$el -})) +const virtualElement = ref({ getBoundingClientRect: () => ({}) }) + +function openContextMenu () { + const top = unref(y) + const left = unref(x) + + virtualElement.value.getBoundingClientRect = () => ({ + width: 0, + height: 0, + top, + left + }) + isContextMenuOpen.value = true +} const customQuery = query => computed(() => query.value ? `${query.value} | =1` : '')