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.

198 lines
5.8 KiB

2 months ago
  1. import { defineMixin } from '../../libs/vue'
  2. import defProps from '../../libs/config/props.js'
  3. export const props = defineMixin({
  4. props: {
  5. // #ifdef VUE3
  6. // 绑定的值
  7. modelValue: {
  8. type: [String, Number],
  9. default: () => defProps.input.value
  10. },
  11. // #endif
  12. // #ifdef VUE2
  13. // 绑定的值
  14. value: {
  15. type: [String, Number],
  16. default: () => defProps.input.value
  17. },
  18. // #endif
  19. // number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数
  20. // idcard-身份证输入键盘,微信、支付宝、百度、QQ小程序
  21. // digit-带小数点的数字键盘,App的nvue页面、微信、支付宝、百度、头条、QQ小程序
  22. // text-文本输入键盘
  23. type: {
  24. type: String,
  25. default: () => defProps.input.type
  26. },
  27. // 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,
  28. // 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序
  29. fixed: {
  30. type: Boolean,
  31. default: () => defProps.input.fixed
  32. },
  33. // 是否禁用输入框
  34. disabled: {
  35. type: Boolean,
  36. default: () => defProps.input.disabled
  37. },
  38. // 禁用状态时的背景色
  39. disabledColor: {
  40. type: String,
  41. default: () => defProps.input.disabledColor
  42. },
  43. // 是否显示清除控件
  44. clearable: {
  45. type: Boolean,
  46. default: () => defProps.input.clearable
  47. },
  48. // 是否密码类型
  49. password: {
  50. type: Boolean,
  51. default: () => defProps.input.password
  52. },
  53. // 最大输入长度,设置为 -1 的时候不限制最大长度
  54. maxlength: {
  55. type: [String, Number],
  56. default: () => defProps.input.maxlength
  57. },
  58. // 输入框为空时的占位符
  59. placeholder: {
  60. type: String,
  61. default: () => defProps.input.placeholder
  62. },
  63. // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/
  64. placeholderClass: {
  65. type: String,
  66. default: () => defProps.input.placeholderClass
  67. },
  68. // 指定placeholder的样式
  69. placeholderStyle: {
  70. type: [String, Object],
  71. default: () => defProps.input.placeholderStyle
  72. },
  73. // 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效
  74. showWordLimit: {
  75. type: Boolean,
  76. default: () => defProps.input.showWordLimit
  77. },
  78. // 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档
  79. // https://uniapp.dcloud.io/component/input
  80. // https://uniapp.dcloud.io/component/textarea
  81. confirmType: {
  82. type: String,
  83. default: () => defProps.input.confirmType
  84. },
  85. // 点击键盘右下角按钮时是否保持键盘不收起,H5无效
  86. confirmHold: {
  87. type: Boolean,
  88. default: () => defProps.input.confirmHold
  89. },
  90. // focus时,点击页面的时候不收起键盘,微信小程序有效
  91. holdKeyboard: {
  92. type: Boolean,
  93. default: () => defProps.input.holdKeyboard
  94. },
  95. // 自动获取焦点
  96. // 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点
  97. focus: {
  98. type: Boolean,
  99. default: () => defProps.input.focus
  100. },
  101. // 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效
  102. autoBlur: {
  103. type: Boolean,
  104. default: () => defProps.input.autoBlur
  105. },
  106. // 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效
  107. disableDefaultPadding: {
  108. type: Boolean,
  109. default: () => defProps.input.disableDefaultPadding
  110. },
  111. // 指定focus时光标的位置
  112. cursor: {
  113. type: [String, Number],
  114. default: () => defProps.input.cursor
  115. },
  116. // 输入框聚焦时底部与键盘的距离
  117. cursorSpacing: {
  118. type: [String, Number],
  119. default: () => defProps.input.cursorSpacing
  120. },
  121. // 光标起始位置,自动聚集时有效,需与selection-end搭配使用
  122. selectionStart: {
  123. type: [String, Number],
  124. default: () => defProps.input.selectionStart
  125. },
  126. // 光标结束位置,自动聚集时有效,需与selection-start搭配使用
  127. selectionEnd: {
  128. type: [String, Number],
  129. default: () => defProps.input.selectionEnd
  130. },
  131. // 键盘弹起时,是否自动上推页面
  132. adjustPosition: {
  133. type: Boolean,
  134. default: () => defProps.input.adjustPosition
  135. },
  136. // 输入框内容对齐方式,可选值为:left|center|right
  137. inputAlign: {
  138. type: String,
  139. default: () => defProps.input.inputAlign
  140. },
  141. // 输入框字体的大小
  142. fontSize: {
  143. type: [String, Number],
  144. default: () => defProps.input.fontSize
  145. },
  146. // 输入框字体颜色
  147. color: {
  148. type: String,
  149. default: () => defProps.input.color
  150. },
  151. // 输入框前置图标
  152. prefixIcon: {
  153. type: String,
  154. default: () => defProps.input.prefixIcon
  155. },
  156. // 前置图标样式,对象或字符串
  157. prefixIconStyle: {
  158. type: [String, Object],
  159. default: () => defProps.input.prefixIconStyle
  160. },
  161. // 输入框后置图标
  162. suffixIcon: {
  163. type: String,
  164. default: () => defProps.input.suffixIcon
  165. },
  166. // 后置图标样式,对象或字符串
  167. suffixIconStyle: {
  168. type: [String, Object],
  169. default: () => defProps.input.suffixIconStyle
  170. },
  171. // 边框类型,surround-四周边框,bottom-底部边框,none-无边框
  172. border: {
  173. type: String,
  174. default: () => defProps.input.border
  175. },
  176. // 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会
  177. readonly: {
  178. type: Boolean,
  179. default: () => defProps.input.readonly
  180. },
  181. // 输入框形状,circle-圆形,square-方形
  182. shape: {
  183. type: String,
  184. default: () => defProps.input.shape
  185. },
  186. // 用于处理或者过滤输入框内容的方法
  187. formatter: {
  188. type: [Function, null],
  189. default: () => defProps.input.formatter
  190. },
  191. // 是否忽略组件内对文本合成系统事件的处理
  192. ignoreCompositionEvent: {
  193. type: Boolean,
  194. default: true
  195. }
  196. }
  197. })