BaseInput.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="search-input">
  3. <el-input
  4. :placeholder="placeholder"
  5. :value="value"
  6. @input="onInput($event)"
  7. @blur="$emit('onBlur')"
  8. @focus="$emit('onFocus')"
  9. @clear="$emit('onClear', value)"
  10. clearable
  11. >
  12. </el-input>
  13. </div>
  14. </template>
  15. <script>
  16. import { Input } from 'element-ui'
  17. export default {
  18. name: 'Search-Input',
  19. props: {
  20. placeholder: String,
  21. value: String
  22. },
  23. components: {
  24. [Input.name]: Input
  25. },
  26. model: {
  27. prop: 'value',
  28. event: 'onInput'
  29. },
  30. data() {
  31. return {}
  32. },
  33. methods: {
  34. onInput(e) {
  35. this.$emit('onInput', e)
  36. }
  37. }
  38. }
  39. </script>
  40. <style scoped lang="scss">
  41. .search-input {
  42. position: relative;
  43. width: 640px;
  44. @include diy-icon('search-white', 24);
  45. ::v-deep .el-input__inner {
  46. border-radius: 4px;
  47. background: #ffffff;
  48. border: 1px solid #e0e0e0;
  49. padding: 0 16px;
  50. color: #1d1d1d;
  51. font-size: 14px;
  52. line-height: 24px;
  53. height: 36px;
  54. }
  55. ::v-deep .el-input-group__append {
  56. height: 42px;
  57. box-sizing: border-box;
  58. text-align: center;
  59. border: none;
  60. border-radius: 0px 22px 22px 0px;
  61. background: #2cb7ca;
  62. .el-button {
  63. padding: 8px 19px;
  64. margin-top: -4px;
  65. }
  66. }
  67. }
  68. </style>