test.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="search">
  3. <picker style="width: 50%;" @change="bindPickerChange($event,1)" :value="typeIndex" :range="typeList">
  4. <view class="search-type">
  5. {{typeList[typeIndex]}}
  6. <div class="search-type-img">
  7. <img src="../static/bottom.png">
  8. </div>
  9. </view>
  10. </picker>
  11. <picker style="width: 50%;" @change="bindPickerChange($event,2)" :value="timeIndex" :range="timeList">
  12. <view class="search-time">
  13. {{timeList[timeIndex]}}
  14. <div class="search-time-img">
  15. <img src="../static/bottom.png">
  16. </div>
  17. </view>
  18. </picker>
  19. </view>
  20. </template>
  21. <script setup>
  22. import {
  23. ref
  24. } from "vue"
  25. defineProps({
  26. typeList: Array,
  27. timeList: Array
  28. })
  29. const typeIndex = ref(0)
  30. const timeIndex = ref(0)
  31. const conveyData = defineEmits(["handLeConveyData"])
  32. const bindPickerChange = (e, type) => {
  33. if (type === 1) {
  34. typeIndex.value = e.detail.value
  35. } else {
  36. timeIndex.value = e.detail.value
  37. }
  38. conveyData("handLeConveyData", {
  39. typeIndex: typeIndex.value,
  40. timeIndex: timeIndex.value,
  41. })
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .search {
  46. display: flex;
  47. justify-content: space-around;
  48. align-items: center;
  49. margin-bottom: 20rpx;
  50. height: 100rpx;
  51. font-size: 28rpx;
  52. background-color: #fff;
  53. .search-type {
  54. flex: 1;
  55. display: flex;
  56. justify-content: space-evenly;
  57. .search-type-img {
  58. margin-top: -5rpx;
  59. width: 17rpx;
  60. height: 12rpx;
  61. img {
  62. width: 100%;
  63. height: 100%;
  64. }
  65. }
  66. }
  67. .search-time {
  68. flex: 1;
  69. display: flex;
  70. justify-content: space-evenly;
  71. .search-time-img {
  72. margin-top: -5rpx;
  73. width: 17rpx;
  74. height: 12rpx;
  75. img {
  76. width: 100%;
  77. height: 100%;
  78. }
  79. }
  80. }
  81. }
  82. </style>