mynavbar.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <!-- 自定义导航栏 -->
  3. <view class="navBarBox">
  4. <!-- 状态栏占位 -->
  5. <view class="statusBar" :style="{paddingTop:statusBarHeight + 'rpx'}">
  6. </view>
  7. <!-- 直正的导航栏内容 -->
  8. <view class="navBar">
  9. <view class="logo"></view>
  10. <!-- <image class="logo" src="/static/images/shouye2@3x.png" mode="aspectFit" @click="leftbuttonsel(1)"></image> -->
  11. <view class="textlable">
  12. <view class="lableT">{{title}}</view>
  13. <view class="lableB">{{titledetl}}</view>
  14. </view>
  15. <view class="rightconten">
  16. <uni-icons class="mycart" custom-prefix="custom-icon" color="white" type="more-filled" size="32" @click="leftbuttonsel(2)"></uni-icons>
  17. <!--<image v-if="LinterestBT===1" class="interest" src="/static/images/购物车.png" mode="aspectFit" @click="leftbuttonsel(2)"></image>
  18. <image v-if="LmycartBT===1" class="mycart" src="/static/images//购物车.png" mode="aspectFit" @click="leftbuttonsel(3)"></image>-->
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default
  25. {
  26. props:{
  27. title:"",
  28. titledetl:"",
  29. interestBT:0,
  30. mycartBT:0,
  31. },
  32. data() {
  33. return{
  34. // 状态栏高度
  35. statusBarHeight:0,
  36. // 导航栏高度
  37. navBarHeight: 82,
  38. LinterestBT:this.interestBT,
  39. LmycartBT:this.mycartBT,
  40. };
  41. },
  42. //第一次加载时调用
  43. created() {
  44. //获取手机状态栏高度
  45. var systemInfo = uni.getSystemInfoSync();
  46. this.statusBarHeight=systemInfo.statusBarHeight+10;
  47. },
  48. methods:{
  49. leftbuttonsel(item){
  50. //触发一个更新事件
  51. this.$emit('Enavbarsel',item);
  52. }
  53. },
  54. }
  55. </script>
  56. <style>
  57. .navBar {
  58. width: 90%;
  59. margin-left: 5%;
  60. display: flex;
  61. flex-direction: row;
  62. justify-content: left;
  63. align-items: center
  64. }
  65. .logo {
  66. width: 70rpx;
  67. height: 70rpx;
  68. margin-left: 6rpx;
  69. }
  70. .textlable{
  71. flex-direction:column;
  72. margin-left: 16rpx;
  73. }
  74. .lableT{
  75. font-size: 28rpx;
  76. color: white;
  77. }
  78. .lableB{
  79. font-size: 22rpx;
  80. color: white;
  81. }
  82. .rightconten{
  83. margin-left: auto;
  84. display: flex;
  85. flex-direction: row;
  86. justify-content:right;
  87. }
  88. .interest {
  89. margin-right: 10rpx;
  90. width: 82rpx;
  91. height: 82rpx;
  92. }
  93. .mycart {
  94. margin-right: 10rpx;
  95. width: 82rpx;
  96. height: 82rpx;
  97. }
  98. </style>