index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <!-- 搜索框 -->
  3. <view class="diy-search">
  4. <view class="inner" :class="itemStyle.searchStyle" @click="onTargetSearch">
  5. <view class="search-input" :style="{ textAlign: itemStyle.textAlign }">
  6. <text class="search-icon iconfont icon-sousuo"></text>
  7. <text> {{ params.placeholder }}</text>
  8. </view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. /**
  15. * 组件的属性列表
  16. * 用于组件自定义设置
  17. */
  18. props: {
  19. itemIndex: String,
  20. itemStyle: Object,
  21. params: Object
  22. },
  23. /**
  24. * 组件的方法列表
  25. * 更新属性和数据的方法与更新页面数据的方法类似
  26. */
  27. methods: {
  28. /**
  29. * 跳转到搜索页面
  30. */
  31. onTargetSearch() {
  32. this.$navTo('pages/search/index')
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. .diy-search {
  39. background: $fuint-theme;
  40. padding: 20rpx 20rpx;
  41. font-size: 26rpx;
  42. }
  43. .inner {
  44. height: 60rpx;
  45. background: $fuint-theme;
  46. overflow: hidden;
  47. &.radius {
  48. border-radius: 10rpx;
  49. }
  50. &.round {
  51. border-radius: 60rpx;
  52. }
  53. }
  54. .search-input {
  55. height: 60rpx;
  56. line-height: 60rpx;
  57. color: #999;
  58. padding: 0 20rpx;
  59. background: $fuint-theme;
  60. .search-icon {
  61. margin-right: 8rpx;
  62. }
  63. }
  64. </style>