en-input.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. height: 114rpx;
  70. background-color: #ffffff;
  71. .input-box {
  72. height: 98rpx;
  73. display: flex;
  74. align-items: center;
  75. .input-box-left {
  76. width: 210rpx;
  77. font-size: 32rpx;
  78. color: #333333;
  79. }
  80. }
  81. .box-solid{
  82. border-bottom: 1px solid #F0F0F0;
  83. margin-bottom:26rpx;
  84. }
  85. }
  86. </style>