mynavbar.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- 自定义导航栏 -->
  3. <view class="navBarBox">
  4. <!-- 状态栏占位 -->
  5. <view class="statusBar" :style="{paddingTop:statusBarHeight + 'rpx'}">
  6. </view>
  7. <!-- 直正的导航栏内容 -->
  8. <view class="navBar">
  9. <image class="logo" src="/static/meishi/location.png" mode="aspectFit" @click="leftbuttonsel(1)"></image>
  10. <view class="textlable" @click="leftbuttonsel(1)">
  11. <view class="lableT textfontB4">
  12. <text class="titleT">{{title}}</text>
  13. </view>
  14. <view class="lableB textfontS2">
  15. <text class="changduxz">{{titledetl}}</text>
  16. </view>
  17. </view>
  18. <!-- <view class="rightconten">
  19. <image class="interest" src="/static/meishi/notifcation.png" mode="aspectFit" @click="leftbuttonsel(2)"></image>
  20. </view> -->
  21. </view>
  22. <view class="contentColumnC">
  23. <uni-search-bar class="searchbar" :placeholder="$t('index.searchgoods')" cancelButton="none" locateButton="always" :readonly="readonly" v-on:searchClick="searchClick"></uni-search-bar>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default
  29. {
  30. props:{
  31. title:"",
  32. titledetl:"",
  33. interestBT:0,
  34. mycartBT:0,
  35. },
  36. data() {
  37. return{
  38. // 状态栏高度
  39. statusBarHeight:0,
  40. // 导航栏高度
  41. navBarHeight: 100,
  42. LinterestBT:this.interestBT,
  43. LmycartBT:this.mycartBT,
  44. readonly:true,
  45. };
  46. },
  47. //第一次加载时调用
  48. created() {
  49. //获取手机状态栏高度
  50. var systemInfo = uni.getSystemInfoSync();
  51. this.statusBarHeight=systemInfo.statusBarHeight*2;
  52. },
  53. methods:{
  54. leftbuttonsel(item){
  55. //触发一个更新事件
  56. this.$emit('Enavbarsel',1);
  57. },
  58. searchClick(){
  59. this.$emit('Enavbarsel',2);
  60. }
  61. },
  62. }
  63. </script>
  64. <style>
  65. .navBarBox{
  66. display: flex;
  67. flex-direction: column;
  68. justify-content: center;
  69. width: 100%;
  70. background-color: #00A6FF;
  71. }
  72. .navBar {
  73. display: flex;
  74. flex-direction: row;
  75. align-items: center;
  76. width: 90%;
  77. margin-left: 5%;
  78. margin-top: 40rpx;
  79. height: 100rpx;
  80. }
  81. .searchbar{
  82. width: 90%;
  83. }
  84. .logo {
  85. width: 56rpx;
  86. height: 56rpx;
  87. margin-left: 6rpx;
  88. }
  89. .textlable{
  90. flex-direction:column;
  91. margin-left: 8rpx;
  92. width: 80%;
  93. }
  94. .lableT{
  95. color: black;
  96. }
  97. .lableB{
  98. color: black;
  99. }
  100. .titleT{
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. display: -webkit-box;
  104. -webkit-line-clamp: 1;
  105. -webkit-box-orient: vertical;
  106. }
  107. .changduxz{
  108. overflow: hidden;
  109. text-overflow: ellipsis;
  110. display: -webkit-box;
  111. -webkit-line-clamp: 2;
  112. -webkit-box-orient: vertical;
  113. }
  114. .rightconten{
  115. margin-left: auto;
  116. display: flex;
  117. flex-direction: row;
  118. justify-content:right;
  119. }
  120. .interest {
  121. margin-right: 10rpx;
  122. width: 54rpx;
  123. height: 54rpx;
  124. }
  125. .mycart {
  126. margin-right: 10rpx;
  127. width: 82rpx;
  128. height: 82rpx;
  129. }
  130. </style>