subcate.js 819 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const app = getApp();
  2. Page({
  3. data: {
  4. subCate: []
  5. },
  6. /**
  7. * 生命周期函数--监听页面加载
  8. */
  9. onLoad: function (options) {
  10. this.getCate();
  11. },
  12. /**
  13. * 获取子分类
  14. */
  15. getCate: function () {
  16. let that = this;
  17. app.util.request({
  18. url: 'entry/wxapp/index',
  19. data: {
  20. controller: 'recipe.get_recipe_categorylist'
  21. },
  22. dataType: 'json',
  23. success: function (res) {
  24. if (res.data.code == 0) {
  25. let subCate = res.data.data || [];
  26. that.setData({ subCate })
  27. }
  28. }
  29. })
  30. },
  31. goList: function(e){
  32. let subId = e.currentTarget.dataset.id || '';
  33. let name = e.currentTarget.dataset.name || '';
  34. wx.navigateTo({
  35. url: `/lionfish_comshop/moduleA/menu/list?gid=${subId}&name=${name}`
  36. })
  37. }
  38. })