I am a newby in Vue3 and PrimeVue.
I am working on a prototype app with a menubar.
My problem now is, that I am planing to have a general click function for all menubar items.
I will use the key option inside the click function to identify which item was clicked.
But I do not know how to pass this option as input parameter into this function.
This is how I declaired the items array and the click function for the menubar inside the <script> Tag
Code: Select all
const items = ref([
{
key: 1,
label: "File",
command: () => onMenuItemClicked(),
items: [
{
label: "Open Project",
icon: "pi pi-fw pi-file-import"
},
{
label: "Save Project",
icon: "pi pi-fw pi-file-export"
}
]
},
const onMenuItemClicked = () => {
console.log("item clicked");
}
Code: Select all
<template>
<MenuBar v-if="show" :model="items"/>
Thank you very much.