statusBar.vue 2.4 KB

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