en-input.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="box">
  3. <view class="input-box">
  4. <view class="input-box-left">
  5. {{ label }}
  6. </view>
  7. <input
  8. :name="name"
  9. :type="type"
  10. :placeholder="placeholder ? placeholder : ''"
  11. :disabled="!!disabled"
  12. v-model="inputValue"
  13. />
  14. </view>
  15. <view class="box-solid"></view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'en-input',
  21. props: {
  22. type: {
  23. type: String,
  24. default: 'text'
  25. },
  26. label: {
  27. type: String,
  28. default: '标题'
  29. },
  30. placeholder: {
  31. type: String,
  32. default: '请输入'
  33. },
  34. disabled: {
  35. default: false
  36. },
  37. name: {
  38. type: String,
  39. default: 'text'
  40. },
  41. value: {
  42. default: ''
  43. }
  44. },
  45. data() {
  46. return {
  47. inputValue: ''
  48. }
  49. },
  50. components: {},
  51. mounted() {
  52. this.inputValue = this.value
  53. },
  54. watch: {
  55. 'value': function () {
  56. if (this.inputValue !== this.value) {
  57. this.inputValue = this.value
  58. }
  59. },
  60. 'inputValue': function () {
  61. this.$emit('input', this.inputValue)
  62. }
  63. },
  64. methods: {}
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .box{
  69. background-color: #ffffff;
  70. padding: 34rpx 0 12rpx 0;
  71. .input-box {
  72. display: flex;
  73. align-items: center;
  74. .input-box-left {
  75. width: 210rpx;
  76. font-size: 32rpx;
  77. color: #333333;
  78. }
  79. }
  80. .box-solid{
  81. border-bottom: 1px solid #F0F0F0;
  82. margin-top:22rpx;
  83. }
  84. }
  85. </style>