navBar.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // components/navBar/navBar.js
  2. const app = getApp()
  3. Component({
  4. properties: {
  5. title: {
  6. type: String,
  7. value: '跨境电商专利小助手'
  8. },
  9. control: {
  10. type: Boolean,
  11. value: true,
  12. },
  13. bgcolor: {
  14. type: String,
  15. value: "",
  16. },
  17. color: {
  18. type: String,
  19. value: "",
  20. }
  21. },
  22. data: {
  23. opacity: 0,
  24. navBarHeight: app.globalData.navBarHeight,
  25. menuRight: app.globalData.menuRight,
  26. menuTop: app.globalData.menuTop,
  27. menuHeight: app.globalData.menuHeight,
  28. menuWidth: app.globalData.menuWidth,
  29. },
  30. attached: function () {
  31. wx.setStorageSync('isComponent', true)
  32. },
  33. detached: function () {
  34. // 清理工作
  35. wx.setStorageSync('isComponent', false)
  36. },
  37. methods: {
  38. //返回
  39. clickBack(){
  40. var pages = getCurrentPages()
  41. if (pages.length >= 2) {
  42. // if(pages[pages.length-2].route == "pageIndex/mine/mine" && pages[pages.length-1].route == "pages/login/login"){
  43. // // if(pages.length == 2){
  44. // // wx.switchTab({
  45. // // url: '/pageIndex/index/index'
  46. // // });
  47. // // }else{
  48. // wx.navigateBack({
  49. // delta: 2
  50. // })
  51. // // }
  52. // }else{
  53. wx.navigateBack()
  54. // }
  55. } else {
  56. wx.switchTab({
  57. url: '/pageIndex/index/index'
  58. });
  59. }
  60. },
  61. // 胶囊--首页
  62. clickHome() {
  63. wx.switchTab({
  64. url: "/pageIndex/index/index"
  65. });
  66. },
  67. },
  68. })