Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

86 rindas
1.8 KiB

  1. <template>
  2. <view v-if="!simpleMode" :class="className" :style="style">
  3. <view class="cu-form-group" style="border-bottom: none; padding-bottom: 0">
  4. <view class="title">
  5. <text v-if="required" style="color: red; font-size: 1.2em">*</text>
  6. {{ title || "" }}
  7. </view>
  8. </view>
  9. <view class="cu-form-group" style="position: relative; border-top: none">
  10. <textarea
  11. @input="textareaInput"
  12. :maxlength="maxlength"
  13. :placeholder="displayPlaceHolder"
  14. :value="value"
  15. :auto-height="autoHeight"
  16. :disabled="readonly"
  17. :enableNative="false"
  18. style="margin-top: 0; border-top: none"
  19. controlled
  20. ></textarea>
  21. </view>
  22. </view>
  23. <view
  24. v-else
  25. :class="className"
  26. :style="style"
  27. class="cu-form-group"
  28. style="position: relative"
  29. >
  30. <textarea
  31. @input="textareaInput"
  32. :maxlength="maxlength"
  33. :placeholder="displayPlaceHolder"
  34. :fixed="fixed"
  35. :value="value"
  36. :style="textareaStyle"
  37. :auto-height="autoHeight"
  38. :disabled="readonly"
  39. :enableNative="false"
  40. controlled
  41. ></textarea>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. name: "l-textarea",
  47. props: {
  48. maxlength: { default: -1 },
  49. readonly: {},
  50. placeholder: {},
  51. fixed: {},
  52. value: {},
  53. textareaStyle: {},
  54. autoHeight: {},
  55. simpleMode: {},
  56. required: {},
  57. title: {},
  58. disabled: {},
  59. },
  60. methods: {
  61. textareaInput(e) {
  62. this.$emit("change", e.detail.value);
  63. this.$emit("input", e.detail.value);
  64. },
  65. },
  66. computed: {
  67. displayPlaceHolder() {
  68. if (this.readonly) {
  69. return "";
  70. }
  71. if (this.placeholder) {
  72. return this.placeholder;
  73. }
  74. return !this.simpleMode && this.title ? `请输入${this.title}` : "请输入…";
  75. },
  76. },
  77. };
  78. </script>