menu.js 825 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. //使用全局样式
  17. options: {
  18. addGlobalClass: true,
  19. },
  20. /**
  21. * ����ij�ʼ����
  22. */
  23. data: {
  24. showmenus:true,
  25. },
  26. /**
  27. * ����ķ����б�
  28. */
  29. methods: {
  30. showclick:function(){
  31. let isshow = !this.data.showmenus;
  32. this.setData({
  33. showmenus: isshow,
  34. })
  35. },
  36. itemclick:function(e){
  37. this.showclick();
  38. let info = e.currentTarget.dataset.item;
  39. if (info){
  40. this.triggerEvent('menuItemClick', {
  41. "iteminfo":info
  42. })
  43. }
  44. }
  45. }
  46. })