cm-custom.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template name="headerNavbar">
  2. <!-- 自定义导航栏 -->
  3. <view class='navbar-wrap' :style="{height:(CustomBar+55)+'px',paddingTop:StatusBar+'px'}">
  4. <view class="navbar-text"
  5. :style="{color:navbarData.textColor ? navbarData.textColor:'',lineHeight:(CustomBar - StatusBar)+'px;',fontSize:fontSizeSetting+'px;',paddingLeft:navbarData.textLeft ? '' : capsule.height+'px'}" :class="platformClass">
  6. {{navbarData.title ? navbarData.title : " "}}
  7. </view>
  8. <view class="search-input">
  9. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  10. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  11. <text>{{hotSearchText}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. var self;
  18. import btSearch from '@/components/uni-search/bt-search.vue'
  19. export default{
  20. name:'headerNavbar',
  21. components:{
  22. btSearch,
  23. },
  24. props:{
  25. navbarData: { // 由父页面传递的数据
  26. type: Object
  27. }
  28. },
  29. data() {
  30. return{
  31. clickPath:'/pages/search/search',
  32. hotSearchText:'你想要的这里都有',
  33. CustomBar:this.CustomBar,// 顶部导航栏高度
  34. StatusBar: this.StatusBar,
  35. fontSizeSetting:this.fontSizeSetting,
  36. screenWidth:this.screenWidth,
  37. capsule:this.capsule,
  38. platformClass:this.platformClass,
  39. }
  40. },
  41. created() {
  42. if (getCurrentPages().length === 1) { // 当只有一个页面时
  43. this.navbarData.haveBack = false;
  44. } else {
  45. this.navbarData.haveBack = true;
  46. }
  47. },
  48. onLoad(){
  49. },
  50. methods:{
  51. BackPage: function () {
  52. this.$emit('navigateBack')
  53. },
  54. _goSearchPath:function () {
  55. this.$emit('goSearchPath')
  56. },
  57. _goHome:function(){
  58. uni.switchTab({
  59. url: '/pages/tabBar/home/home'
  60. })
  61. }
  62. },
  63. onShow(){
  64. }
  65. }
  66. </script>
  67. <style lang="scss">
  68. .navbar-wrap {
  69. position: fixed;
  70. width: 100%;
  71. top: 0;
  72. z-index: 100000;
  73. box-sizing: border-box;
  74. background: url(https://admin-b.caimei365.com/userfiles/1/images/photo/2020/05/%E8%83%8C%E6%99%AF1%402x.png);
  75. background-size: cover;
  76. border-bottom:none;
  77. }
  78. .navbar-text {
  79. font-size: 30rpx;
  80. color: #000000;
  81. font-weight: 500;
  82. }
  83. .navbar-text.center{
  84. text-align: center;
  85. }
  86. .navbar-text.left{
  87. text-align: left;
  88. padding-left: 45px;
  89. }
  90. .navbar-icon {
  91. position: fixed;
  92. display: flex;
  93. box-sizing: border-box;
  94. }
  95. .navbar-icon .iconfont {
  96. display: inline-block;
  97. overflow: hidden;
  98. font-size: 44rpx;
  99. padding-right:40rpx;
  100. margin-top: 1px;
  101. }
  102. .navbar-icon .icon-iconfonticonfontsousuo1 {
  103. color: #000000;
  104. }
  105. .navbar-icon view {
  106. height: 18px;
  107. border-left: 0.5px solid rgba(0,0,0, 0.3);
  108. margin-top: 6px;
  109. }
  110. .navbar-loading {
  111. background: #fff;
  112. text-align: center;
  113. }
  114. .search-input{
  115. width: 100%;
  116. height: 70rpx;
  117. padding: 20rpx 0;
  118. .gosearch-btn{
  119. /* #ifndef APP-NVUE */
  120. display: flex;
  121. /* #endif */
  122. flex: 1;
  123. flex-direction: row;
  124. justify-content: center;
  125. align-items: center;
  126. width: 662rpx;
  127. height: 100%;
  128. border-radius: 40rpx;
  129. background: #F0F0F0;
  130. margin: 0 auto;
  131. padding:0 20rpx;
  132. font-size: 28rpx;
  133. line-height: 70rpx;
  134. color: #8A8A8A;
  135. background: #FFFFFF;
  136. .icon-iconfonticonfontsousuo1{
  137. margin:0 6rpx;
  138. font-size: 34rpx;
  139. color: #8A8A8A;
  140. z-index: 10;
  141. }
  142. }
  143. }
  144. </style>