search.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="search-container">
  3. <navbar>
  4. <view class="nav">
  5. <view class="nav-back" @click="$navigateBack()">
  6. <uni-icons type="left" size="20"></uni-icons>
  7. </view>
  8. <input type="text" class="nav-search" placeholder="请输入房源名称或项目名称" v-model="searchValue" focus
  9. confirm-type="search" @confirm="search"
  10. :style="'height:' + boundingClientRect.height + 'px;border-radius:' + boundingClientRect.height + 'px;line-height:'+(boundingClientRect.height-2)+'px'" />
  11. <view class="wx-operation"
  12. :style="'width:' + boundingClientRect.width + 'px;height:'+ boundingClientRect.height+'px;'">
  13. </view>
  14. </view>
  15. </navbar>
  16. <view class="search-tag" :style="'margin-top: '+getNavBarHeight()+'rpx;'">
  17. <view class="tag-title">标签列表</view>
  18. <view class="tag-list">
  19. <view class="tag-item">
  20. 标签1
  21. </view>
  22. <view class="tag-item">
  23. 标签2
  24. </view>
  25. <view class="tag-item">
  26. 标签3
  27. </view>
  28. </view>
  29. <view class="tag-title">历史搜索</view>
  30. <view class="tag-list">
  31. <view class="tag-item">
  32. 维绿大厦
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import navbar from "@/components/common/navbar.vue";
  40. export default {
  41. data() {
  42. return {
  43. boundingClientRect: {},
  44. searchValue: ''
  45. }
  46. },
  47. onShow() {
  48. this.boundingClientRect = wx.getMenuButtonBoundingClientRect();
  49. },
  50. methods: {
  51. // 获取状态栏高度
  52. geStatusBarHeight() {
  53. return uni.getSystemInfoSync()['statusBarHeight']
  54. },
  55. // 获取导航栏高度
  56. getNavBarHeight() {
  57. // #ifdef MP-WEIXIN
  58. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  59. // 导航栏高度 = 胶囊高度 + 上间距 + 下间距 + 微调 (menuButtonInfo.top - uni.getSystemInfoSync()['statusBarHeight'] = 上间距)
  60. let navbarHeight = menuButtonInfo.height + (menuButtonInfo.top - uni.getSystemInfoSync()[
  61. 'statusBarHeight']) * 2 + 2
  62. // #endif
  63. // #ifdef APP-PLUS || H5
  64. let navbarHeight = 44
  65. // #endif
  66. return (navbarHeight + this.geStatusBarHeight() + 15) * 2;
  67. },
  68. search() {
  69. this.$navigateTo('/pages/searchlist/searchlist?searchValue=' + this.searchValue);
  70. }
  71. },
  72. components: {
  73. navbar
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. .search-container {
  79. .nav {
  80. height: 100%;
  81. background: #fff;
  82. width: 100%;
  83. display: flex;
  84. align-items: center;
  85. .nav-back {
  86. padding-left: 10rpx;
  87. }
  88. .nav-search {
  89. flex: 1;
  90. width: 0;
  91. border: 1px solid $uni-border-1;
  92. line-height: 1;
  93. padding-left: 30rpx;
  94. margin: 0 20rpx;
  95. box-sizing: border-box;
  96. margin-bottom: 4rpx;
  97. font-weight: 200;
  98. height: 64rpx;
  99. border-radius: 64rpx;
  100. line-height: 60rpx;
  101. }
  102. .wx-operation {
  103. margin-right: 8px;
  104. margin-bottom: 4rpx;
  105. }
  106. }
  107. .search-tag {
  108. background: #fff;
  109. padding: 30rpx 0 0 30rpx;
  110. .tag-title {
  111. font-size: 24rpx;
  112. font-weight: bold;
  113. color: $uni-base-color;
  114. margin-bottom: 20rpx;
  115. }
  116. .tag-list {
  117. display: flex;
  118. flex-wrap: wrap;
  119. }
  120. .tag-item {
  121. background: $uni-background-color;
  122. padding: 10rpx 20rpx;
  123. color: $uni-base-color;
  124. font-weight: 300;
  125. margin-right: 30rpx;
  126. margin-bottom: 30rpx;
  127. font-size: 24rpx;
  128. border-radius: 8rpx;
  129. }
  130. }
  131. }
  132. </style>