menu.js 882 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. console.log("showclick")
  31. let isshow = !this.data.showmenus;
  32. console.log(isshow)
  33. this.setData({
  34. showmenus: isshow,
  35. })
  36. },
  37. itemclick:function(e){
  38. this.showclick();
  39. console.log(e.currentTarget.dataset);
  40. let info = e.currentTarget.dataset.item;
  41. if (info){
  42. this.triggerEvent('menuItemClick', {
  43. "iteminfo":info
  44. })
  45. }
  46. }
  47. }
  48. })