You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

130 rivejä
3.6 KiB

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