index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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, 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. .search{
  37. width: 100%;
  38. background: #FFFFFF;
  39. border-radius: 34rpx;
  40. padding: 6rpx 6rpx 6rpx 26rpx;
  41. box-sizing: border-box;
  42. .icon{
  43. width: 36rpx;
  44. height: 36rpx;
  45. }
  46. .input{
  47. flex: 1;
  48. padding: 0 11rpx;
  49. box-sizing: border-box;
  50. }
  51. .btn{
  52. padding: 9rpx 27rpx;
  53. background: #B7F358;
  54. border-radius: 34rpx;
  55. font-family: PingFangSC, PingFang SC;
  56. font-weight: 400;
  57. font-size: 26rpx;
  58. color: #252525;
  59. line-height: 37rpx;
  60. }
  61. }
  62. </style>