one-textarea.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="com-plan-content">
  3. <view class="title">
  4. <text>{{ title }}</text>
  5. </view>
  6. <view class="item-container">
  7. <view class="label-view">
  8. <text>{{ label }}</text>
  9. </view>
  10. <view class="content">
  11. <textarea class="textarea"
  12. :key="title"
  13. placeholder="请输入"
  14. placeholder-style="color: #B8BECC"
  15. :maxlength="-1"
  16. auto-height
  17. :value="defaultValue"
  18. :disabled="disabled"
  19. @input="changeVal"
  20. />
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. // 单个多行输入框 (改善计划(Plan)/oneTextarea)
  27. export default {
  28. props: {
  29. // 类型 (plan 和 action)
  30. type: {
  31. type: String,
  32. default: 'plan'
  33. },
  34. // 对策处置默认值
  35. defaultValue: {
  36. type: String,
  37. default: ''
  38. },
  39. // 是否禁用
  40. disabled: {
  41. type: Boolean,
  42. default: false
  43. },
  44. },
  45. computed: {
  46. // 多行文本框标题
  47. title() {
  48. return this.type === 'plan' ? '改善计划(Plan)' : '对策处置(Action)'
  49. },
  50. // 多行文本框子标题
  51. label() {
  52. return this.type === 'plan' ? '改善计划' : '对策处置'
  53. }
  54. },
  55. methods: {
  56. changeVal(e) {
  57. this.$emit('changeTextare', this.type, e.target.value);
  58. }
  59. },
  60. }
  61. </script>
  62. <style lang="less">
  63. .com-plan-content {
  64. height: 100%;
  65. padding-top: 35rpx;
  66. .title {
  67. line-height: 35rpx;
  68. padding: 0 25rpx;
  69. text {
  70. font-size: 35rpx;
  71. color: #292C33;
  72. }
  73. }
  74. .item-container {
  75. display: flex;
  76. margin-top: 25rpx;
  77. padding-left: 25rpx;
  78. background-color: #FFFFFF;
  79. .label-view {
  80. width: 175rpx;
  81. line-height: 37.5rpx;
  82. padding: 25rpx 0;
  83. >text {
  84. font-size: 22.5rpx;
  85. color: #666F80;
  86. }
  87. }
  88. .content {
  89. flex: 1;
  90. padding: 25rpx 0;
  91. .textarea {
  92. width: 100%;
  93. min-height: 810rpx;
  94. padding: 0 25rpx;
  95. line-height: 37.5rpx;
  96. font-size: 22.5rpx;
  97. color: #525866;
  98. box-sizing: border-box;
  99. }
  100. }
  101. }
  102. }
  103. </style>