Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user customized menu id mid #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

huanhe4096
Copy link

@huanhe4096 huanhe4096 commented Sep 22, 2023

Users can add a mid to each menu item to identify which menu item is clicked/touched.

For example, in the HelloWorld.vue

menu: [
  { mid: "new_file", name: "New File", iconSlot: "file" },
  { mid: "new_win", name: "New Window", iconSlot: "window" },
  { mid: "open_file", name: "Open File", iconSlot: "folderopen" },
]

When handleSelected event, the mid is included in the return object:

const handleSelected = (item) => {
    console.log(item);
};

When clicking "New File", it will show { pmid: "new_file", name: "New File", path: ...}.

I hope this can be helpful to address issue #61 and #62

@prabhuignoto
Copy link
Owner

@huanhe4096 thanks for opening the PR. just curious why we need a special mid attribute. which menu item is clicked/touched can be detected even without that

@huanhe4096
Copy link
Author

huanhe4096 commented Sep 22, 2023

@huanhe4096 thanks for opening the PR. just curious why we need a special mid attribute. which menu item is clicked/touched can be detected even without that

Hello @prabhuignoto ! For most of time, I think the existing attributes are good enough. The need for mid in our case is that our PM often change the menu name and structure ... for example, move "File>Settings" to "Edit>Preferences", or move "Help>About us" to "Icon>About" ... so we want to keep this appearance changing away from the actual function implementation, although it's not a big change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants