en-input.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'en-input',
  20. props: {
  21. type: {
  22. type: String,
  23. default: 'text'
  24. },
  25. label: {
  26. type: String,
  27. default: '标题'
  28. },
  29. placeholder: {
  30. type: String,
  31. default: '请输入'
  32. },
  33. disabled: {
  34. default: false
  35. },
  36. name: {
  37. type: String,
  38. default: 'text'
  39. },
  40. value: {
  41. default: ''
  42. }
  43. },
  44. data() {
  45. return {
  46. inputValue: ''
  47. }
  48. },
  49. components: {},
  50. mounted() {
  51. this.inputValue = this.value
  52. },
  53. watch: {
  54. 'value': function () {
  55. if (this.inputValue !== this.value) {
  56. this.inputValue = this.value
  57. }
  58. },
  59. 'inputValue': function () {
  60. this.$emit('input', this.inputValue)
  61. }
  62. },
  63. methods: {}
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. @import url("../static/css/en-common.css");
  68. .box{
  69. .input-box {
  70. display: flex;
  71. align-items: center;
  72. .input-box-left {
  73. width: 210rpx;
  74. font-size: 32rpx;
  75. color: #333333;
  76. }
  77. }
  78. }
  79. </style>