search.wxml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <view class="main">
  2. <view class="search-box">
  3. <input class="search-input" placeholder="搜索" value="{{value}}" bindinput="searchInput" />
  4. <icon class="weui-icon-search_in-box search-icon" type="search" size="14"></icon>
  5. <text class="search-btn" wx:if="{{showResult}}" bindtap="cancelSearch">取消</text>
  6. </view>
  7. <view class="result" wx:if="{{showResult}}">
  8. <view class="result-box" wx:if="{{result.length > 0}}">
  9. <view class="result-list" wx:for="{{result}}" wx:key="index">
  10. <navigator url="{{item.url}}">
  11. <image src="{{item.thumb}}"></image>
  12. <view class="result-text">
  13. <text>{{item.title}}</text>
  14. </view>
  15. <view class="result-text">
  16. <text>¥ {{item.price}}</text>
  17. </view>
  18. </navigator>
  19. </view>
  20. </view>
  21. <view class="result-null" wx:else>
  22. <view class="null-tips">Oh~~ 搜索结果为空!</view>
  23. <view class="recommend-title">
  24. <text>相关推荐</text>
  25. </view>
  26. <view class="recommend-box">
  27. <view class="result-list" wx:for="{{result}}" wx:key="index">
  28. <navigator url="{{item.url}}">
  29. <image src="{{item.thumb}}"></image>
  30. <view class="result-text">
  31. <text>{{item.title}}</text>
  32. </view>
  33. <view class="result-text">
  34. <text>¥ {{item.price}}</text>
  35. </view>
  36. </navigator>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="init-page" wx:else>
  42. <view wx:if="{{history.length > 0}}">
  43. <view class="title">
  44. <text>搜索记录</text>
  45. </view>
  46. <view class="tags">
  47. <text wx:for="{{history}}" wx:key="index" data-text="{{item}}" bindtap="keywordHandle">{{item}}</text>
  48. </view>
  49. </view>
  50. <view class="title">
  51. <text>热点推荐</text>
  52. </view>
  53. <view class="tags">
  54. <text wx:for="{{hot}}" wx:key="index" data-text="{{item}}" bindtap="keywordHandle">{{item}}</text>
  55. </view>
  56. </view>
  57. <view class="keywords" wx:if="{{showKeywords}}">
  58. <view class="keywords-item" wx:for="{{keywords}}" wx:key="index" data-text="{{item}}" bindtap="keywordHandle">{{item}}</view>
  59. </view>
  60. </view>