Nav

导航的菜单列表。

使用

  1. <m-nav id='myNav' nodes="[{
  2. title: 'p-0',
  3. id: 1,
  4. icon: 'account_balance_wallet',
  5. children: [
  6. {
  7. title: 'p-1',
  8. id: 2,
  9. icon: 'assignment_ind',
  10. children: [
  11. { title: 'p-2', id: 3, icon: 'chrome_reader_mode', checked: true },
  12. { title: 'p-2.5', id: 13, icon: 'chrome_reader_mode' }
  13. ]
  14. },
  15. {
  16. title: 'p-4',
  17. id: 4,
  18. icon: 'extension',
  19. children: [
  20. {
  21. title: 'p-5', id: 5, selected: true, icon: 'dashboard', checked: true,
  22. disabled: true
  23. },
  24. { title: '项目六', id: 6, icon: 'favorite' },
  25. { title: '项目7', id: 7 }
  26. ]
  27. }
  28. ]
  29. },
  30. {
  31. title: 'p-11',
  32. id: 14,
  33. icon: 'group_work',
  34. children: [
  35. {
  36. title: 'p-12', id: 12, icon: 'fingerprint', checked: true
  37. }
  38. ]
  39. }]">
  40. </m-nav>

Javascript

  1. var myNav = document.querySelector('#myNav')
  2. myNav.addEventListener('toggle', (evt) => {
  3. console.log(evt.detail)
  4. })
  5. myNav.addEventListener('nodeClick', (evt) => {
  6. console.log(evt.detail)
  7. })
  8. console.log(myNav.props.nodes)

API

Props

  1. {
  2. nodes: obj
  3. }

Event

  1. {
  2. toggle: function,
  3. nodeclick: function
  4. }