searchInput.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="flex_ac" style="height: 88rpx; width: 100%">
  3. <view class="input-con">
  4. <image src="/static/image/matser/search.png" mode=""></image>
  5. <input
  6. @input="keychange"
  7. v-model="keyvalue"
  8. @confirm="confirm"
  9. confirm-type="search"
  10. class="f28_302"
  11. type="text"
  12. placeholder="请输入"
  13. placeholder-style="color:#CCCCCC"
  14. />
  15. <view class="cancel-btn">
  16. <text @click="search">搜索</text>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. value: ''
  25. },
  26. data() {
  27. return {
  28. keyvalue: ''
  29. }
  30. },
  31. methods: {
  32. keychange(e) {
  33. this.$emit('input', e)
  34. },
  35. confirm(e) {
  36. this.$emit('search', e.detail.value)
  37. },
  38. search() {
  39. this.$emit('search', this.keyvalue)
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .input-con {
  46. @include flex_ac;
  47. flex: 1;
  48. padding: 0 0 0 24rpx;
  49. height: 64rpx;
  50. background: #f7f7f7;
  51. border-radius: 32rpx;
  52. input {
  53. flex: 1;
  54. }
  55. .cancel-btn {
  56. width: 66px;
  57. height: 32px;
  58. background: #6da7ff;
  59. border-radius: 16px;
  60. text-align: center;
  61. text {
  62. width: 27px;
  63. height: 14px;
  64. font-size: 14px;
  65. font-family: PingFang SC, PingFang SC-Medium;
  66. font-weight: 500;
  67. text-align: center;
  68. color: #ffffff;
  69. line-height: 30px;
  70. }
  71. }
  72. image {
  73. width: 28rpx;
  74. height: 28rpx;
  75. margin-right: 16rpx;
  76. }
  77. }
  78. </style>