statusBar.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Component({
  2. /**
  3. * 组件的属性列表
  4. */
  5. properties: {
  6. receiveData: {
  7. type: null,
  8. observer: function (newVal, oldVal) {
  9. // let gradeText = '一年级'
  10. // switch (newVal.grade) {
  11. // case 'PRESCHOOL':
  12. // gradeText = '学前班';
  13. // break;
  14. // case 'PRIMARY_FIRST_GRADE':
  15. // gradeText = '一年级';
  16. // break;
  17. // case 'PRIMARY_SECOND_GRADE':
  18. // gradeText = '二年级';
  19. // break;
  20. // case 'PRIMARY_THREE_GRADE':
  21. // gradeText = '三年级';
  22. // break;
  23. // }
  24. this.setData({
  25. isshowbtn: newVal.isshowbtn, //是否显示按钮
  26. title: newVal.title, //标题
  27. // grade: gradeText
  28. })
  29. }
  30. },
  31. grade: {
  32. type: 'String',
  33. observer: function (newVal) {
  34. console.log('年级', newVal)
  35. let gradeText = '一年级'
  36. switch (newVal) {
  37. case 'PRESCHOOL':
  38. gradeText = '学前班';
  39. break;
  40. case 'PRIMARY_FIRST_GRADE':
  41. gradeText = '一年级';
  42. break;
  43. case 'PRIMARY_SECOND_GRADE':
  44. gradeText = '二年级';
  45. break;
  46. case 'PRIMARY_THREE_GRADE':
  47. gradeText = '三年级';
  48. break;
  49. case 'PRIMARY_SENIOR_GRADE':
  50. gradeText = '四年级';
  51. break;
  52. }
  53. this.setData({
  54. gradeText: gradeText
  55. })
  56. }
  57. }
  58. },
  59. /**
  60. * 组件的初始数据
  61. */
  62. data: {
  63. statusBarHeight: getApp().globalData.statusBarHeight
  64. },
  65. /**
  66. * 组件的方法列表
  67. */
  68. methods: {
  69. //点击年级
  70. gradeTap: function () {
  71. console.log("点击年级");
  72. this.triggerEvent('gradeTap', 'false');
  73. console.log('状态栏高度', this.data.statusBarHeight)
  74. },
  75. prePageTap: function () {
  76. console.log('点击返回')
  77. wx.navigateBack({
  78. delta: 1
  79. })
  80. }
  81. }
  82. })