C端小程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

82 linhas
1.6 KiB

  1. const app = getApp()
  2. Component({
  3. properties: {
  4. background: {
  5. type: String,
  6. value: '#F4F5F9'
  7. },
  8. color: {
  9. type: String,
  10. value: '#000'
  11. },
  12. text: {
  13. type: String,
  14. value: 'Wechat'
  15. },
  16. showLocationIf: {
  17. type: Boolean,
  18. value: false
  19. },
  20. back: {
  21. type: Boolean,
  22. value: false
  23. },
  24. home: {
  25. type: Boolean,
  26. value: false
  27. },
  28. },
  29. data: {
  30. array: ['A广场', 'B广场-北京西单'],
  31. index: 1,
  32. statusBarHeight: app.statusBarHeight + 'px',
  33. navigationBarHeight: (app.statusBarHeight + 44) + 'px',
  34. },
  35. methods: {
  36. backHome: function () {
  37. let url = app.globalData.goHomeUrl
  38. wx.switchTab({
  39. url: url,
  40. })
  41. },
  42. bindPickerChange: function (e) {
  43. console.log('picker发送选择改变,携带值为', e.detail.value)
  44. this.setData({
  45. index: e.detail.value
  46. })
  47. },
  48. back: function () {
  49. wx.navigateBack({
  50. delta: 1
  51. })
  52. // const pages = getCurrentPages();
  53. // console.log(`页面栈:${JSON.stringify(pages)}`, pages.length);
  54. // if (pages.length === 2) {
  55. // wx.navigateBack({
  56. // delta: 1
  57. // });
  58. // } else if (pages.length === 1) {
  59. // wx.reLaunch({
  60. // url: '/pages/theme/index1/index',
  61. // })
  62. // } else {
  63. // wx.navigateBack({
  64. // delta: 1
  65. // });
  66. // }
  67. }
  68. },
  69. attached: function () {
  70. let pages = getCurrentPages();
  71. if (pages.length <= 1) {
  72. this.setData({
  73. back: false
  74. })
  75. }
  76. }
  77. })