项目作者: eidng8

项目描述 :
A Vue.js multi-level popup menu.
高级语言: Vue
项目地址: git://github.com/eidng8/popup-menu.git
创建时间: 2020-05-03T10:43:32Z
项目社区:https://github.com/eidng8/popup-menu

开源协议:GNU General Public License v3.0

下载


popup-menu

master build vulnerabilities maintainability master coverage dev build dev coverage

A Vue.js multi-level popup menu, using a page like navigation inside the menu container.

Demo

Props

Prop name Description Type Default
idKey Field name in the menu item data set that holds item identifier. string ‘id’
labelKey Field name in the menu item data set that holds item label. string ‘label’
subtitleKey Field name in the menu item data set that holds item subtitle. string ‘subtitle’
hintKey Field name in the menu item data set that holds item tool tip. string ‘hint’
checkerKey Field name in the menu item data set that tells whether the item has a
checkbox attached.
string ‘checker’
checkedKey Field name in the menu item data set that holds item’s checkbox is checked. string ‘checked’
shortcutKey Field name in the menu item data set that holds item keyboard shortcut. string ‘shortcut’
childrenKey Field name in the menu item data set that holds sub-menu item. string ‘children’
addElementId Whether to add element id attribute, using the idKey field. boolean false

Slots

Name Description Bindings
default Item label item: G8MenuItem
subtitle Item subtitle item: G8MenuItem

Events

Event name Type Description
open MouseEvent The popup menu has been opened.
close G8MenuItem The popup menu has been closed.
click G8MenuItemClicked A menu item has been clicked.
state-changed G8MenuItem A checkbox in the menu item has been checked or unchecked.
select G8MenuItem A menu item has been selected.

Types

  1. /**
  2. * Menu item. Fields listed here serve default data structure. There can be
  3. * arbitrary fields in the data set. Actual fields used in rendering can be
  4. * customized using component properties such as `idKey`.
  5. */
  6. export interface G8MenuItem {
  7. /**
  8. * Arbitrary field declaration, also enables accessing via index.
  9. */
  10. [key: string]: unknown | undefined;
  11. /**
  12. * Arbitrary field declaration, also enables accessing via index.
  13. */
  14. [key: number]: unknown | undefined;
  15. /**
  16. * Default menu item identifier.
  17. */
  18. id?: string;
  19. /**
  20. * Default menu item label. `'---'` here denotes a separator item. Separator
  21. * item will not close menu or trigger any event.
  22. */
  23. label?: string;
  24. /**
  25. * Default menu item subtitle.
  26. */
  27. subtitle?: string;
  28. /**
  29. * Default menu item tool tip (mouse hover).
  30. */
  31. hint?: string;
  32. /**
  33. * Whether the item has a checkbox attached. Items with checkbox will not
  34. * close the menu while clicked. However, the `click` event will be fired,
  35. * followed by `state-changed` event.
  36. */
  37. checker?: boolean;
  38. /**
  39. * Whether checkbox of the item has been checked.
  40. */
  41. checked?: boolean;
  42. /**
  43. * Keyboard shortcut, must be on single character.
  44. */
  45. shortcut?: string;
  46. /**
  47. * Sub-menu items
  48. */
  49. children?: G8MenuItem[];
  50. }
  51. /**
  52. * A menu item has been clicked.
  53. */
  54. export class G8MenuItemClicked extends Event {
  55. /**
  56. * The item that was clicked.
  57. */
  58. data?: G8MenuItem;
  59. }