index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="search adfac">
  3. <image class="icon" src="https://oss.familydaf.cn/sxsnfile/20251218/9093140778f4463489a7e83746b70ab2.png"></image>
  4. <view class="input">
  5. <up-input :placeholder="placeholder" v-model="keyword" border="none" style="font-size: 26rpx;" @confirm="handleSearch"></up-input>
  6. </view>
  7. <view class="btn" @click="handleSearch" v-if="!isCancel">搜索</view>
  8. <view class="btn" @click="handleCancel" v-else>取消</view>
  9. </view>
  10. </template>
  11. <script setup name="CusSearch">
  12. defineProps({
  13. placeholder:{
  14. typeof: String,
  15. default: '查找公益活动'
  16. },
  17. isCancel:{
  18. typeof: Boolean,
  19. default: false
  20. }
  21. })
  22. import { ref, onMounted } from 'vue'
  23. const keyword = ref('')
  24. const emits = defineEmits(['handleSearch','handleCancel'])
  25. const handleSearch = () => {
  26. emits('handleSearch',keyword.value);
  27. }
  28. const handleCancel = () => {
  29. emits('handleCancel');
  30. }
  31. defineExpose({
  32. keyword
  33. })
  34. </script>
  35. <style scoped lang="scss">
  36. ::v-deep .u-input__content input{
  37. caret-color: #252525;
  38. }
  39. .search{
  40. width: 100%;
  41. background: #FFFFFF;
  42. border-radius: 34rpx;
  43. padding: 6rpx 6rpx 6rpx 26rpx;
  44. box-sizing: border-box;
  45. .icon{
  46. width: 36rpx;
  47. height: 36rpx;
  48. }
  49. .input{
  50. flex: 1;
  51. padding: 0 11rpx;
  52. box-sizing: border-box;
  53. }
  54. .btn{
  55. padding: 9rpx 27rpx;
  56. background: #B7F358;
  57. border-radius: 34rpx;
  58. font-family: PingFangSC, PingFang SC;
  59. font-weight: 400;
  60. font-size: 26rpx;
  61. color: #252525;
  62. line-height: 37rpx;
  63. }
  64. }
  65. </style>