statusBar.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="statusBar">
  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. </view>
  7. <view class="navTit" :style="{paddingTop:navTop+ 'px',lineHeight:meunButtonInfo+'px'}">
  8. <view class="postTit" @click="switchTab(index)">{{item.title}} </view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name:"statusBar",
  16. props:{
  17. item:{
  18. type:Object,
  19. default(){
  20. return{
  21. title:'',
  22. btn:1 //判断是否显示返回按钮
  23. }
  24. }
  25. }
  26. },
  27. data() {
  28. return {
  29. navheight:this.navheight, //导航栏高度
  30. statusHeight:this.statusHeight, //状态栏高度
  31. navTop:this.navTop, //胶囊离顶高度
  32. meunButtonInfo:this.meunButtonInfo, //胶囊高度
  33. appAllHeight:this.customBar,//app导航栏高度
  34. };
  35. },
  36. methods:{
  37. backIndex(){
  38. uni.navigateBack({
  39. url:this.item.btn
  40. })
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. .statusBar{
  47. .nav{
  48. width: 750rpx;
  49. position: relative;
  50. // border-bottom-left-radius: 30rpx;
  51. // border-bottom-right-radius: 30rpx;
  52. background-color: #FFFFFF;
  53. // background: linear-gradient( 100deg ,#65cff4 20%,#c8b8ee 80%);
  54. position: sticky;
  55. top: 0;
  56. // z-index: 1;
  57. .backBtnSty{
  58. // position: absolute;
  59. width: 40rpx;height: 40rpx;
  60. margin-left: 15rpx;
  61. margin-top:50rpx;
  62. image{
  63. width: 40rpx;height: 40rpx;
  64. }
  65. }
  66. .navTit{
  67. width: 260rpx;
  68. height: 44px;
  69. margin: auto;
  70. color: #ffffff;
  71. // font-family: 'Microsoft YaHei';
  72. text-align: center;
  73. display: flex;
  74. justify-content: space-around;
  75. .postTit{
  76. height: 40px;
  77. color: #000;
  78. font-weight: bold;
  79. display: inline-block; /* 将容器设置为行内块元素 */
  80. vertical-align: bottom; /* 将文字垂直对齐到底部 */
  81. }
  82. }
  83. }
  84. .tab-item-active {
  85. color: #FFFFFF !important;
  86. font-size: 18px;
  87. font-weight: bold;
  88. }
  89. }
  90. </style>