statusBar.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="statusBar" :style="{height: meunButtonInfo? navheight + 'px': customBar +'px'}">
  3. <view class="nav" v-if="meunButtonInfo" :style="{height:navheight + 'px'}">
  4. <view v-if="item.btn" class="backBtnSty" style="position: fixed;transform: translate(0,-50%);" :style="{width:'30px',marginTop:navTop+meunButtonInfo/2 +'px'}">
  5. <!-- <image @click="backIndex" src="../../static/logo.png" mode="aspectFill"></image> -->
  6. <uni-icons @click="backIndex" type="back" size="25"></uni-icons>
  7. </view>
  8. <view class="navTit" :style="{paddingTop:navTop+ 'px',lineHeight:meunButtonInfo+'px'}">
  9. <view class="postTit">{{item.title}} </view>
  10. </view>
  11. </view>
  12. <!-- app端 -->
  13. <!-- <view class="nav" v-else :style="{height:customBar +'px'}">
  14. <view v-if="item.btn" class="backBtnSty" style="position: fixed;transform: translate(0,-50%);" :style="{width:'30px',marginTop:appAllHeight/2 +'px'}">
  15. <uni-icons @click="backIndex" type="back" size="20"></uni-icons>
  16. </view>
  17. <view class="navTit" :style="{lineHeight:customBar+'px'}">
  18. <view class="postTit">{{item.title}} </view>
  19. </view>
  20. </view> -->
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name:"statusBar",
  26. props:{
  27. item:{
  28. type:Object,
  29. default(){
  30. return{
  31. title:'',
  32. btn:1 //判断是否显示返回按钮 0不显示 1显示 2返回首页
  33. }
  34. }
  35. }
  36. },
  37. data() {
  38. return {
  39. navheight:this.navheight, //导航栏高度
  40. statusHeight:this.statusHeight, //状态栏高度
  41. navTop:this.navTop, //胶囊离顶高度
  42. meunButtonInfo:this.meunButtonInfo, //胶囊高度
  43. appAllHeight:this.customBar,//app导航栏高度
  44. };
  45. },
  46. methods:{
  47. backIndex(){
  48. if(this.item.btn==2){
  49. uni.switchTab({
  50. url:'/pages/index/index'
  51. })
  52. return
  53. }
  54. uni.navigateBack()
  55. }
  56. },
  57. onLoad() {
  58. // console.log(this.meunButtonInfo);
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .statusBar{
  64. // background-color: #000;
  65. }
  66. .nav{
  67. width: 750rpx;
  68. background-color: #FFFFFF;
  69. position: fixed;
  70. top: 0;
  71. z-index: 11;
  72. .backBtnSty{
  73. width: 40rpx;
  74. height: 40rpx;
  75. margin-left: 30rpx;
  76. margin-top:50rpx;
  77. image{
  78. width: 16rpx;height: 28rpx;
  79. }
  80. }
  81. .navTit{
  82. width: 260rpx;
  83. height: 44px;
  84. margin: auto;
  85. color: #ffffff;
  86. // font-family: 'Microsoft YaHei';
  87. text-align: center;
  88. display: flex;
  89. justify-content: space-around;
  90. .postTit{
  91. height: 40px;
  92. color: rgba(0, 0, 0, 0.88);
  93. font-size: 34rpx;
  94. // font-family: Microsoft YaHei;
  95. font-weight: bold;
  96. display: inline-block; /* 将容器设置为行内块元素 */
  97. vertical-align: bottom; /* 将文字垂直对齐到底部 */
  98. }
  99. }
  100. }
  101. .tab-item-active {
  102. color: #FFFFFF !important;
  103. font-size: 18px;
  104. font-weight: bold;
  105. }
  106. </style>