index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="search adfac">
  3. <image class="icon" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/d568b395-8490-4e44-af30-7fb5288b8bad.png"></image>
  4. <div class="input">
  5. <up-input :placeholder="placeholder" v-model="keyword" border="none" style="font-size: 26rpx;" @confirm="handleSearch"></up-input>
  6. </div>
  7. <div class="btn" @tap="handleSearch" v-if="!isCancel">搜索</div>
  8. <div class="btn" @tap="handleCancel" v-else>取消</div>
  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 } 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. </script>
  32. <style scoped lang="scss">
  33. .search{
  34. width: 100%;
  35. background: #FFFFFF;
  36. border-radius: 34rpx;
  37. padding: 6rpx 6rpx 6rpx 26rpx;
  38. box-sizing: border-box;
  39. .icon{
  40. width: 36rpx;
  41. height: 36rpx;
  42. }
  43. .input{
  44. flex: 1;
  45. padding: 0 11rpx;
  46. box-sizing: border-box;
  47. }
  48. .btn{
  49. padding: 9rpx 27rpx;
  50. background: #B7F358;
  51. border-radius: 34rpx;
  52. font-family: PingFangSC, PingFang SC;
  53. font-weight: 400;
  54. font-size: 26rpx;
  55. color: #252525;
  56. line-height: 37rpx;
  57. }
  58. }
  59. </style>