bar-search-title.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="zaiui-bar-search-title-box">
  3. <view class="cu-bar" :class="[fixed?'fixed':'', shadow?'':'no-shadow', bgColor]">
  4. <view class="action" @tap="BackPage" v-if="isBack">
  5. <text class="cuIcon-back"/>
  6. </view>
  7. <view class="content search" @tap="contentTap">
  8. <view class="search-form round">
  9. <text class="cuIcon-search"/>
  10. <text class="margin-left-xs">{{content}}</text>
  11. </view>
  12. </view>
  13. <view class="action" @tap="rightTap">
  14. <!--小程序端不显示-->
  15. <!-- #ifndef MP -->
  16. <slot name="right"/>
  17. <!-- #endif -->
  18. </view>
  19. </view>
  20. <!--占位的-->
  21. <view class="zaiui-seat-height" v-if="fixed"/>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: 'bar-search-title',
  27. props: {
  28. bgColor: {
  29. type: String,
  30. default: ''
  31. },
  32. content: {
  33. type: String,
  34. default: '输入关键字'
  35. },
  36. isBack: {
  37. type: Boolean,
  38. default: true
  39. },
  40. fixed: {
  41. type: Boolean,
  42. default: true
  43. },
  44. shadow: {
  45. type: Boolean,
  46. default: false
  47. }
  48. },
  49. methods: {
  50. BackPage() {
  51. uni.navigateBack();
  52. },
  53. contentTap() {
  54. this.$emit('contentTap');
  55. },
  56. rightTap() {
  57. this.$emit('rightTap');
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .zaiui-bar-search-title-box {
  64. .cu-bar {
  65. padding-top: var(--status-bar-height);
  66. min-height: calc(var(--status-bar-height) + 101upx);
  67. .content {
  68. top: var(--status-bar-height);
  69. /* #ifndef MP */
  70. width: calc(100% - 181.81upx);
  71. /* #endif */
  72. /* #ifdef MP */
  73. left: -140upx;
  74. width: calc(100% - 300upx);
  75. /* #endif */
  76. .search-form {
  77. display: inherit;
  78. flex: inherit;
  79. margin: 0;
  80. color: #717171;
  81. [class*="cuIcon-"] {
  82. margin: 0;
  83. }
  84. }
  85. }
  86. }
  87. .cu-bar.fixed.no-shadow {
  88. box-shadow: inherit;
  89. }
  90. .cu-bar.bg-white {
  91. color: #333333;
  92. }
  93. .zaiui-seat-height {
  94. width: 100%;
  95. height: calc(var(--status-bar-height) + 101upx);
  96. }
  97. }
  98. </style>