vInput.vue 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="d-flex align-center">
  3. <slot name="left"></slot>
  4. <input @input="input" @blur="$emit('blur',$event)" v-bind="{...$props}" class="flex-fill" />
  5. <slot name="right"></slot>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: "vInput",
  11. props: {
  12. value: {
  13. defalult: "",
  14. require: false,
  15. },
  16. type: {
  17. default: "text",
  18. type: String,
  19. require: false,
  20. },
  21. placeholder: {
  22. default: "",
  23. type: String,
  24. require: false,
  25. },
  26. maxLength: {
  27. default: undefined,
  28. type: String,
  29. require: false,
  30. },
  31. minLength: {
  32. default: undefined,
  33. type: String,
  34. require: false,
  35. },
  36. disabled: {
  37. default: false,
  38. type: Boolean,
  39. require: false,
  40. },
  41. },
  42. methods:{
  43. input($ev){
  44. this.$emit('input',$ev.target.value)
  45. }
  46. }
  47. };
  48. </script>
  49. <style lang="scss">
  50. input {
  51. color: inherit;
  52. font-size: inherit;
  53. text-align: inherit;
  54. width: auto;
  55. min-width: 0;
  56. }
  57. </style>