use-header.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view>
  3. <view class="use-header dflex padding-lr-sm w-full bg-drak" :class="fixed ? 'fixed' : ''">
  4. <!-- 头部组件 -->
  5. <view class="use-search dflex-b border-radius-lg padding-lr w-full" @click="search">
  6. <text>{{ searchTip }}</text>
  7. <view class="iconfont iconsousuo-01"></view>
  8. </view>
  9. </view>
  10. <!-- 头部组件占位符 -->
  11. <view v-if="fixed && placeholder" class="use-header-placeholder"></view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. fixed: {
  18. type: [Number, Boolean],
  19. default: false
  20. },
  21. placeholder: {
  22. type: [Number, Boolean],
  23. default: !0
  24. },
  25. searchAuto: {
  26. type: [Number, Boolean],
  27. default: !0
  28. },
  29. searchTip: {
  30. type: String,
  31. default: '搜索关键字'
  32. },
  33. id: {
  34. type: [Number, String],
  35. default: 0
  36. },
  37. source: {
  38. type: [Number, String],
  39. default: 1
  40. }
  41. },
  42. data() {
  43. return {};
  44. },
  45. methods: {
  46. search() {
  47. this.$emit('search', {
  48. type: 'search'
  49. });
  50. if (this.searchAuto) {
  51. this.Dever.location('source/search?id=' + this.id + '&source=' + this.source);
  52. }
  53. }
  54. }
  55. };
  56. </script>
  57. <style lang="scss">
  58. .use-header-placeholder {
  59. height: 100rpx;
  60. }
  61. .use-header {
  62. height: 100rpx;
  63. }
  64. .use-search {
  65. height: 70rpx;
  66. line-height: 70rpx;
  67. background-color: #fff;
  68. text {
  69. color: #c0c0c0;
  70. }
  71. .iconfont {
  72. font-size: $font-base + 6upx;
  73. color: #c0c0c0;
  74. }
  75. }
  76. </style>