component.scheme.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. export const propsScheme = {
  2. modelValue: {
  3. type: String,
  4. intro: '绑定值'
  5. },
  6. rows: {
  7. type: Number,
  8. intro: '输入框行数,仅 type 为 \'textarea\' 时有效',
  9. default: 3
  10. },
  11. fixBorder: {
  12. type: Boolean,
  13. intro: '当存在suffix或者prefix时是否使用分割线',
  14. default: false
  15. },
  16. type: {
  17. type: String,
  18. options: ['text', 'textarea'],
  19. intro: '类型',
  20. attr: true
  21. },
  22. maxlength: {
  23. type: Number,
  24. intro: '最大输入长度',
  25. attr: true
  26. },
  27. minlength: {
  28. type: Number,
  29. intro: '原生属性,最小输入长度',
  30. attr: true
  31. },
  32. showWordLimit: {
  33. type: Boolean,
  34. intro: '是否显示输入字数统计,只在 type = "text" 或 type = "textarea" 时有效',
  35. attr: true,
  36. default: false
  37. },
  38. placeholder: {
  39. type: String,
  40. intro: '输入框占位文本',
  41. attr: true
  42. },
  43. clearable: {
  44. type: Boolean,
  45. intro: '是否可清空',
  46. attr: true,
  47. default: false
  48. },
  49. formatter: {
  50. type: Function,
  51. intro: '指定输入值的格式。(只有当 type 是"text"时才有效) function(value: string / number): string',
  52. attr: true
  53. },
  54. parser: {
  55. type: Function,
  56. intro: '指定从格式化器输入中提取的值。(仅当 type 是"text"时才有效) function(value: string): string',
  57. attr: true
  58. },
  59. showPassword: {
  60. type: Boolean,
  61. intro: '是否显示切换密码图标',
  62. attr: true,
  63. default: false
  64. },
  65. disabled: {
  66. type: Boolean,
  67. intro: '是否禁用',
  68. attr: true,
  69. default: false
  70. },
  71. size: {
  72. type: String,
  73. default: 'default',
  74. intro: '大小 只在 type 不为 `textarea` 时有效',
  75. options: ['small', 'default', 'large'],
  76. validate: true,
  77. attr: true
  78. },
  79. prefixIcon: {
  80. type: [String, Object, Function],
  81. intro: '自定义前缀图标'
  82. },
  83. suffixIcon: {
  84. type: [String, Object, Function],
  85. intro: '自定义后缀图标'
  86. },
  87. autosize: {
  88. type: [Boolean, Object],
  89. intro: '输入框行数,仅 type 为 \'textarea\' 时有效',
  90. attr: true,
  91. default: false
  92. },
  93. autocomplete: {
  94. type: String,
  95. intro: '原生 autocomplete 属性',
  96. attr: true,
  97. default: 'off'
  98. },
  99. name: {
  100. type: String,
  101. intro: '等价于原生 input name 属性',
  102. attr: true
  103. },
  104. readonly: {
  105. type: Boolean,
  106. intro: '原生 readonly 属性,是否只读',
  107. attr: true,
  108. default: false
  109. },
  110. max: {
  111. type: [Number, String],
  112. intro: '原生 max 属性,设置最大值'
  113. },
  114. min: {
  115. type: [Number, String],
  116. intro: '原生属性,设置最小值',
  117. attr: true
  118. },
  119. step: {
  120. type: [Number, String],
  121. intro: '原生属性,设置输入字段的合法数字间隔',
  122. attr: true
  123. },
  124. resize: {
  125. type: String,
  126. intro: '控制是否能被用户缩放 none / both / horizontal / vertical',
  127. options: ['none', 'both', 'horizontal', 'vertical'],
  128. attr: true
  129. },
  130. autofocus: {
  131. type: Boolean,
  132. intro: '原生属性,自动获取焦点',
  133. attr: true,
  134. default: false
  135. },
  136. form: {
  137. type: String,
  138. intro: '原生属性',
  139. attr: true
  140. },
  141. label: {
  142. type: String,
  143. intro: '标签文本',
  144. attr: true
  145. },
  146. tabindex: {
  147. type: [String, Number],
  148. intro: '输入框的 tabindex',
  149. attr: true
  150. },
  151. validateEvent: {
  152. type: Boolean,
  153. intro: '原生属性,自动获取焦点',
  154. attr: true,
  155. default: true
  156. },
  157. inputStyle: {
  158. type: Object,
  159. intro: 'input 元素或 textarea 元素的 style',
  160. attr: true,
  161. default: {}
  162. }
  163. }
  164. export const eventsScheme = {
  165. blur: { cbVar: 'e' },
  166. focus: { cbVar: 'e' },
  167. change: { cbVar: 'value' },
  168. input: { cbVar: 'value' },
  169. clear: { }
  170. }
  171. export const slotsScheme = {
  172. prefix: {},
  173. suffix: {},
  174. prepend: {},
  175. append: {}
  176. }
  177. export const componentScheme = {
  178. propsScheme,
  179. slotsScheme,
  180. eventsScheme
  181. }