| 1 |
<template> |
| 2 |
<h3>Menu Props Controls</h3> |
| 3 |
<div class="menu-controls"> |
| 4 |
<label> |
| 5 |
Priority: |
| 6 |
<select> |
| 7 |
<!-- <select v-model="priority">--> |
| 8 |
<option value="primary">Primary</option> |
| 9 |
<option value="secondary">Secondary</option> |
| 10 |
</select> |
| 11 |
</label> |
| 12 |
|
| 13 |
<label> |
| 14 |
Style: |
| 15 |
<select> |
| 16 |
<!-- <select v-model="style">--> |
| 17 |
<option value="fill">Fill</option> |
| 18 |
<option value="ghost">Ghost</option> |
| 19 |
</select> |
| 20 |
</label> |
| 21 |
</div> |
| 22 |
|
| 23 |
<h3>Menu Component Preview</h3> |
| 24 |
<div class="menu-preview"> |
| 25 |
<IvyButtonAction ref="menuButtonRef" @click="openMenu">Open Context Menu</IvyButtonAction> |
| 26 |
<IvyContextMenu /> |
| 27 |
</div> |
| 28 |
</template> |
| 29 |
|
| 30 |
<script setup lang="ts"> |
| 31 |
import { ref } from 'vue' |
| 32 |
import { useContextMenuStore } from '@/stores/contextMenuStore.ts' |
| 33 |
import { |
| 34 |
createContextMenuAction, |
| 35 |
ContextMenuActionType, |
| 36 |
} from '@/views/_components/context-menu/kit/ContextMenuActionType' |
| 37 |
const contextMenuStore = useContextMenuStore() |
| 38 |
const menuButtonRef = ref(null) |
| 39 |
|
| 40 |
const actions = [ |
| 41 |
createContextMenuAction(ContextMenuActionType.Edit), |
| 42 |
createContextMenuAction(ContextMenuActionType.Delete, { |
| 43 |
handler: () => console.log('Custom delete handler'), |
| 44 |
}), |
| 45 |
createContextMenuAction(ContextMenuActionType.Duplicate), |
| 46 |
] |
| 47 |
|
| 48 |
const openMenu = () => { |
| 49 |
contextMenuStore.openContextMenu({ |
| 50 |
actions: actions, |
| 51 |
contextMenuButtonRef: menuButtonRef.value, |
| 52 |
}) |
| 53 |
} |
| 54 |
</script> |
| 55 |
|
| 56 |
<style lang="scss"> |
| 57 |
.menu-preview { |
| 58 |
width: 600px; |
| 59 |
align-items: center; |
| 60 |
} |
| 61 |
</style> |
| 62 |
|