statusBar.vue 2.4 KB

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