props.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import { defineProps } from '../../libs/util/props';
  2. export default defineProps('textarea', {
  3. // 输入框的内容
  4. //#ifdef VUE2
  5. value: {
  6. type: [String, Number],
  7. default: ''
  8. },
  9. // #endif
  10. // #ifdef VUE3
  11. modelValue: {
  12. type: [String, Number],
  13. default: ''
  14. },
  15. // #endif
  16. // 输入框为空时占位符
  17. placeholder: {
  18. type: [String, Number],
  19. default: ''
  20. },
  21. // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/
  22. placeholderClass: {
  23. type: String,
  24. default: 'textarea-placeholder'
  25. },
  26. // 指定placeholder的样式
  27. placeholderStyle: {
  28. type: [String, Object],
  29. default: 'color: #c0c4cc'
  30. },
  31. // 输入框高度
  32. height: {
  33. type: [String, Number],
  34. default: 70
  35. },
  36. // 设置键盘右下角按钮的文字,仅微信小程序,App-vue和H5有效
  37. confirmType: {
  38. type: String,
  39. default: 'done'
  40. },
  41. // 是否禁用
  42. disabled: {
  43. type: Boolean,
  44. default: false
  45. },
  46. // 禁用状态时的背景色
  47. disabledColor: {
  48. type: String,
  49. default: '#f5f7fa'
  50. },
  51. // 是否显示统计字数
  52. count: {
  53. type: Boolean,
  54. default: false
  55. },
  56. // 是否自动获取焦点,nvue不支持,H5取决于浏览器的实现
  57. focus: {
  58. type: Boolean,
  59. default: false
  60. },
  61. // 是否自动增加高度
  62. autoHeight: {
  63. type: Boolean,
  64. default: false
  65. },
  66. // 如果textarea是在一个position:fixed的区域,需要显示指定属性fixed为true
  67. fixed: {
  68. type: Boolean,
  69. default: false
  70. },
  71. // 指定光标与键盘的距离
  72. cursorSpacing: {
  73. type: Number,
  74. default: 0
  75. },
  76. // 指定focus时的光标位置
  77. cursor: {
  78. type: [String, Number],
  79. default: ''
  80. },
  81. // 是否显示键盘上方带有"完成"按钮那一栏,
  82. showConfirmBar: {
  83. type: Boolean,
  84. default: true
  85. },
  86. // 光标起始位置,自动聚焦时有效,需与selection-end搭配使用
  87. selectionStart: {
  88. type: Number,
  89. default: -1
  90. },
  91. // 光标结束位置,自动聚焦时有效,需与selection-start搭配使用
  92. selectionEnd: {
  93. type: Number,
  94. default: -1
  95. },
  96. // 键盘弹起时,是否自动上推页面
  97. adjustPosition: {
  98. type: Boolean,
  99. default: true
  100. },
  101. // 是否去掉 iOS 下的默认内边距,只微信小程序有效
  102. disableDefaultPadding: {
  103. type: Boolean,
  104. default: false
  105. },
  106. // focus时,点击页面的时候不收起键盘,只微信小程序有效
  107. holdKeyboard: {
  108. type: Boolean,
  109. default: false
  110. },
  111. // 最大输入长度,设置为 -1 的时候不限制最大长度
  112. maxlength: {
  113. type: [String, Number],
  114. default: 140
  115. },
  116. // 边框类型,surround-四周边框,bottom-底部边框
  117. border: {
  118. type: String,
  119. default: 'surround'
  120. },
  121. // 用于处理或者过滤输入框内容的方法
  122. formatter: {
  123. type: [Function, null],
  124. default: null
  125. },
  126. // 是否忽略组件内对文本合成系统事件的处理
  127. ignoreCompositionEvent: {
  128. type: Boolean,
  129. default: true
  130. },
  131. // 背景颜色
  132. backgroundColor: {
  133. type: String,
  134. default: '#ffffff'
  135. },
  136. // 边框圆角
  137. round: {
  138. type: String,
  139. default: '4px'
  140. },
  141. // 边框颜色
  142. borderColor: {
  143. type: String,
  144. default: ''
  145. }
  146. })