menu.js 802 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // components/menu/menu.js
  2. Component({
  3. /**
  4. * ����������б�
  5. */
  6. properties: {
  7. mainmodel: {
  8. type: Object,
  9. value: {}
  10. },
  11. menulist: {
  12. type: Object,
  13. value: []
  14. }
  15. },
  16. options: {
  17. addGlobalClass: true,
  18. },
  19. /**
  20. * ����ij�ʼ����
  21. */
  22. data: {
  23. showmenus:true,
  24. },
  25. /**
  26. * ����ķ����б�
  27. */
  28. methods: {
  29. showclick:function(){
  30. let isshow = !this.data.showmenus;
  31. this.setData({
  32. showmenus: isshow,
  33. })
  34. },
  35. itemclick:function(e){
  36. this.showclick();
  37. let info = e.currentTarget.dataset.item;
  38. if (info){
  39. this.triggerEvent('menuItemClick', {
  40. "iteminfo":info
  41. })
  42. }
  43. }
  44. }
  45. })