index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. delta: 1
  32. });
  33. // var pages = getCurrentPages();
  34. // wx.navigateBack({
  35. // delta: pages.length-2
  36. // });
  37. },
  38. setGoodsSearch:function(){
  39. wx.navigateTo({
  40. url: '/pages/goods_search/index',
  41. })
  42. },
  43. setClass:function(){
  44. var color = '';
  45. switch (this.data.parameter.class) {
  46. case "0": case 'on':
  47. color = 'on'
  48. break;
  49. case '1': case 'black':
  50. color = 'black'
  51. break;
  52. case '2': case 'gray':
  53. color = 'gray'
  54. break;
  55. case '3': case "red":
  56. color = 'red'
  57. break;
  58. case '4': case "gradual01":
  59. color = 'gradual01'
  60. break;
  61. default:
  62. break;
  63. }
  64. this.setData({
  65. 'parameter.class': color
  66. })
  67. }
  68. }
  69. })