index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="SearchDetail">
  3. <u--input v-model="searchVal" placeholder="请输入关键字" suffixIcon="search" suffixIconStyle="font-weight: bold"
  4. border="none"
  5. :customStyle="{ height: '88rpx', borderRadius: '20rpx', lineHeight:'88rpx', backgroundColor: '#eee', padding: '0 20rpx 0 40rpx'}"
  6. :clearable="true" @focus="focusSearch" @confirm="clickSearch" @clear="clickClear">
  7. <template slot="suffix">
  8. <u-icon name="search" color="#000" size="60rpx" @click="clickSearch"></u-icon>
  9. </template>
  10. </u--input>
  11. <view class="tabBox">
  12. <view v-for="item in tabList" :key="item.id" :class="{active:activeId ===item.id}" @click="handleSelect(item.id)">
  13. {{item.name}}
  14. </view>
  15. </view>
  16. <view class="list">
  17. <view class="keyWord" v-for="(item,index) in keyWordList" :key="index">{{item}}</view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. searchVal: "", // 搜索内容
  26. activeId: 1, // 当前选中的tab
  27. tabList: [{
  28. id: 1,
  29. name: '热门'
  30. },
  31. {
  32. id: 2,
  33. name: 'Live'
  34. },
  35. {
  36. id: 3,
  37. name: '关注'
  38. },
  39. {
  40. id: 4,
  41. name: '附近'
  42. },
  43. ],
  44. keyWordList: ['就地过年', '张廷芳回应被查出', '啊呀好生菜', '周宇通谭青青哽咽', '韩国人最新作品',
  45. '以巡视多少年', '就地过年', '张廷芳回应被查出', '啊呀好生菜', '周宇通谭青青哽咽', '韩国人最新作品',
  46. '以巡视多少年',
  47. ],
  48. };
  49. },
  50. methods: {
  51. handleSelect(id) {
  52. this.activeId = id
  53. },
  54. focusSearch() {
  55. console.log('input聚焦')
  56. },
  57. clickSearch() {
  58. // this.jump('/pages/searchList/index')
  59. uni.navigateTo({
  60. url: `/pages/searchList/index?searchVal=${this.searchVal}`
  61. });
  62. },
  63. clickClear() {},
  64. }
  65. }
  66. </script>
  67. <style lang="scss">
  68. page {
  69. height: 100%;
  70. // background-color: yellow;
  71. }
  72. .SearchDetail {
  73. padding: 40rpx;
  74. color:#666;
  75. .tabBox {
  76. // padding: 0 40rpx;
  77. display: flex;
  78. align-items: flex-end;
  79. margin-top: 20rpx;
  80. margin-bottom: 50rpx;
  81. >view {
  82. margin-right: 40rpx;
  83. &.active {
  84. color:#000;
  85. font-size: 50rpx;
  86. font-weight: bold;
  87. }
  88. }
  89. }
  90. .list {
  91. -webkit-column-count: 2;
  92. -moz-column-count: 2;
  93. column-count: 2;
  94. -webkit-column-gap: 20px;
  95. -moz-column-gap: 20px;
  96. column-gap: 10rpx;
  97. .keyWord {
  98. margin-bottom: 20rpx;
  99. }
  100. }
  101. }
  102. </style>