search.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view>
  3. <view class="zaiui-bar-search-title-box">
  4. <view class="cu-bar search bg-white fixed no-shadow">
  5. <view class="action" @tap="BackPage">
  6. <text class="cuIcon-back"/>
  7. </view>
  8. <view class="search-form round">
  9. <text class="cuIcon-search"/>
  10. <input @input="searchInput" :value="searchKey" :adjust-position="false" type="text" placeholder="苹果7" confirm-type="search"/>
  11. <text class="cuIcon-close close-icon" v-if="search_close" @tap="closeInput"/>
  12. </view>
  13. <view class="action">
  14. <text class="text-red">搜索</text>
  15. </view>
  16. </view>
  17. <!--占位的-->
  18. <view class="zaiui-seat-height"/>
  19. </view>
  20. <!--搜索区域-->
  21. <view class="padding zaiui-search-list-view" v-if="!deleteView">
  22. <!--搜索记录-->
  23. <view class="search-list-view">
  24. <view class="search-bar-view">
  25. <text class="text-black">历史搜索</text>
  26. <text class="cuIcon-delete text-gray icon-right" @tap="deleteTap"/>
  27. </view>
  28. <view class="btn-view">
  29. <button class="cu-btn round">耳机</button>
  30. <button class="cu-btn round">苹果手机</button>
  31. <button class="cu-btn round">电动车</button>
  32. </view>
  33. </view>
  34. <!--推荐搜索-->
  35. <view class="search-list-view">
  36. <view class="search-bar-view">
  37. <text class="text-black">推荐搜索</text>
  38. </view>
  39. <view class="btn-view">
  40. <button class="cu-btn round">耳机</button>
  41. <button class="cu-btn round">苹果手机</button>
  42. <button class="cu-btn round">电动车</button>
  43. <button class="cu-btn round">笔记本</button>
  44. <button class="cu-btn round">衣柜</button>
  45. <button class="cu-btn round">平板电脑</button>
  46. <button class="cu-btn round">华为手机</button>
  47. <button class="cu-btn round">小米</button>
  48. <button class="cu-btn round">三星</button>
  49. </view>
  50. </view>
  51. </view>
  52. <!--处理历史记录-->
  53. <view class="padding zaiui-search-list-view" v-if="deleteView">
  54. <!--搜索记录-->
  55. <view class="search-list-view">
  56. <view class="search-bar-view">
  57. <text class="text-black">历史搜索</text>
  58. <view class="text-sm text-right">
  59. <text class="text-gray">全部删除</text>
  60. <text class="text-red" @tap="logTap">完成</text>
  61. </view>
  62. </view>
  63. <view class="btn-view">
  64. <button class="cu-btn round">
  65. <text>耳机</text>
  66. <text class="cuIcon-roundclosefill close-icon"/>
  67. </button>
  68. <button class="cu-btn round">
  69. <text>苹果手机</text>
  70. <text class="cuIcon-roundclosefill close-icon"/>
  71. </button>
  72. <button class="cu-btn round">
  73. <text>电动车</text>
  74. <text class="cuIcon-roundclosefill close-icon"/>
  75. </button>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  83. export default {
  84. data() {
  85. return {
  86. search_close: false, searchKey: '', deleteView: false,
  87. }
  88. },
  89. onLoad() {
  90. },
  91. onReady() {
  92. _tool.setBarColor(true);
  93. uni.pageScrollTo({
  94. scrollTop: 0,
  95. duration: 0
  96. });
  97. },
  98. methods: {
  99. BackPage() {
  100. uni.navigateBack();
  101. },
  102. searchInput(event) {
  103. let value = event.detail.value;
  104. this.searchKey = value;
  105. if(value) {
  106. this.search_close = true;
  107. } else {
  108. this.search_close = false;
  109. }
  110. },
  111. closeInput() {
  112. this.searchKey = '';
  113. this.search_close = false;
  114. },
  115. deleteTap() {
  116. this.deleteView = true;
  117. },
  118. logTap() {
  119. this.deleteView = false;
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. /* #ifdef APP-PLUS */
  126. @import "../../static/colorui/main.css";
  127. @import "../../static/colorui/icon.css";
  128. @import "../../static/zaiui/style/app.scss";
  129. /* #endif */
  130. @import "../../static/zaiui/style/search.scss";
  131. </style>