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