nav.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="" >
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <view class="zdyNavLeft">
  8. <image src="../../static/img/nav_icon_back.png" mode="aspectFit" class="backImg" @click="goback"></image>
  9. <view class="navsx"></view>
  10. <image src="../../static/img/nav_icon_home.png" mode="" class="homeImg" @click="gohome"></image>
  11. </view>
  12. <view class="zdyNavTitle">{{title}}</view>
  13. <view style="width: 250rpx;"></view>
  14. </view>
  15. </view>
  16. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  17. <view style="height: 44px;"></view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. props:['title','iStatusBarHeight','cj'],
  23. data() {
  24. return {
  25. }
  26. },
  27. onLoad(opt) {
  28. //this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  29. },
  30. onShow() {
  31. },
  32. methods: {
  33. goback() {
  34. uni.navigateBack({
  35. delta: 1
  36. })
  37. },
  38. gohome(){
  39. console.log(23+this.cj)
  40. if(this.cj==3){
  41. //console.log(123)
  42. uni.switchTab({
  43. url:'../../index/index'
  44. })
  45. }else if(this.cj==4){
  46. uni.switchTab({
  47. url:'/pages/index/index'
  48. })
  49. }else{
  50. uni.switchTab({
  51. url:'../index/index'
  52. })
  53. }
  54. },
  55. }
  56. }
  57. </script>
  58. <style scoped>
  59. .zdyNavBox{
  60. width: 100vw;
  61. background: #FFFFFF;
  62. position: fixed;
  63. top: 0;
  64. left: 0;
  65. z-index: 9999999;
  66. }
  67. .zdyNav{
  68. height: 44px;
  69. display: flex;
  70. justify-content: space-between;
  71. align-items: center;
  72. }
  73. .backImg{
  74. width: 44rpx;
  75. height: 44rpx;
  76. /* margin-left: 10rpx; */
  77. /* margin-right: 20rpx; */
  78. }
  79. .navsx{
  80. width: 2rpx;
  81. height: 44rpx;
  82. background: #e1e1e1;
  83. margin: 0 26rpx 0rpx 18rpx;
  84. }
  85. .homeImg{
  86. width: 44rpx;
  87. height: 44rpx;
  88. }
  89. .zdyNavLeft{
  90. display: flex;
  91. align-items: center;
  92. border: 1px solid #e1e1e1;
  93. margin-left: 15rpx;
  94. border-radius: 35rpx;
  95. padding: 10rpx 23rpx 8rpx 13rpx;
  96. }
  97. .zdyNavTitle{
  98. width: 100vw;
  99. height: 44px;
  100. background: #FFFFFF;
  101. text-align: center;
  102. font-size: 34rpx;
  103. line-height: 44px;
  104. }
  105. </style>