index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var app = getApp();
  2. Component({
  3. properties: {
  4. parameter:{
  5. type: Object,
  6. value:{
  7. class:'0'
  8. },
  9. },
  10. logoUrl:{
  11. type:String,
  12. value:'',
  13. }
  14. },
  15. data: {
  16. navH: ""
  17. },
  18. ready: function(){
  19. this.setClass();
  20. var pages = getCurrentPages();
  21. if (pages.length <= 1) this.setData({'parameter.return':0});
  22. },
  23. attached: function () {
  24. this.setData({
  25. navH: app.globalData.navHeight
  26. });
  27. },
  28. methods: {
  29. return:function(){
  30. wx.navigateBack();
  31. },
  32. setGoodsSearch:function(){
  33. wx.navigateTo({
  34. url: '/pages/goods_search/index',
  35. })
  36. },
  37. setClass:function(){
  38. var color = '';
  39. switch (this.data.parameter.class) {
  40. case "0": case 'on':
  41. color = 'on'
  42. break;
  43. case '1': case 'black':
  44. color = 'black'
  45. break;
  46. case '2': case 'gray':
  47. color = 'gray'
  48. break;
  49. default:
  50. break;
  51. }
  52. this.setData({
  53. 'parameter.class': color
  54. })
  55. }
  56. }
  57. })