props.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.search.value
  10. },
  11. // #endif
  12. // #ifdef VUE2
  13. // 绑定的值
  14. value: {
  15. type: [String, Number],
  16. default: () => defProps.search.value
  17. },
  18. // #endif
  19. // 搜索框形状,round-圆形,square-方形
  20. shape: {
  21. type: String,
  22. default: () => defProps.search.shape
  23. },
  24. // 搜索框背景色
  25. bgColor: {
  26. type: String,
  27. default: () => defProps.search.bgColor
  28. },
  29. // 占位提示文字
  30. placeholder: {
  31. type: String,
  32. default: () => defProps.search.placeholder
  33. },
  34. // 是否启用清除控件
  35. clearabled: {
  36. type: Boolean,
  37. default: () => defProps.search.clearabled
  38. },
  39. // 是否仅聚焦时显示清除控件
  40. onlyClearableOnFocused: {
  41. type: Boolean,
  42. default: true
  43. },
  44. // 是否自动聚焦
  45. focus: {
  46. type: Boolean,
  47. default: () => defProps.search.focus
  48. },
  49. // 是否在搜索框右侧显示取消按钮
  50. showAction: {
  51. type: Boolean,
  52. default: () => defProps.search.showAction
  53. },
  54. // 右侧取消按钮文字
  55. actionText: {
  56. type: String,
  57. default: () => defProps.search.actionText
  58. },
  59. // 搜索框左侧文本
  60. label: {
  61. type: [String, Number, null],
  62. default: () => defProps.search.label
  63. },
  64. // 输入框内容对齐方式,可选值为:left|center|right
  65. inputAlign: {
  66. type: String,
  67. default: () => defProps.search.inputAlign
  68. },
  69. // 是否启用输入框
  70. disabled: {
  71. type: Boolean,
  72. default: () => defProps.search.disabled
  73. },
  74. // 开启showAction时,是否在input获取焦点时才显示
  75. animation: {
  76. type: Boolean,
  77. default: () => defProps.search.animation
  78. },
  79. // 边框颜色,只要配置了颜色,才会有边框
  80. borderColor: {
  81. type: String,
  82. default: () => defProps.search.borderColor
  83. },
  84. // 搜索图标的颜色,默认同输入框字体颜色
  85. searchIconColor: {
  86. type: String,
  87. default: () => defProps.search.searchIconColor
  88. },
  89. // 搜索图标的大小
  90. searchIconSize: {
  91. type: [Number, String],
  92. default: () => defProps.search.searchIconSize
  93. },
  94. // 输入框字体颜色
  95. color: {
  96. type: String,
  97. default: () => defProps.search.color
  98. },
  99. // placeholder的颜色
  100. placeholderColor: {
  101. type: String,
  102. default: () => defProps.search.placeholderColor
  103. },
  104. // 左边输入框的图标,可以为uView图标名称或图片路径
  105. searchIcon: {
  106. type: String,
  107. default: () => defProps.search.searchIcon
  108. },
  109. // 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30px"
  110. margin: {
  111. type: String,
  112. default: () => defProps.search.margin
  113. },
  114. // 应该是uView-plus版本新增的,用于控制搜索图标的插槽位置
  115. iconPosition: {
  116. type: String,
  117. default: () => defProps.search.iconPosition
  118. },
  119. // 输入框最大能输入的长度,-1为不限制长度
  120. maxlength: {
  121. type: [String, Number],
  122. default: () => defProps.search.maxlength
  123. },
  124. // 输入框高度,单位px
  125. height: {
  126. type: [String, Number],
  127. default: () => defProps.search.height
  128. },
  129. // 键盘弹起时,是否自动上推页面
  130. adjustPosition: {
  131. type: Boolean,
  132. default: () => defProps.search.adjustPosition
  133. },
  134. // 键盘收起时,是否自动失去焦点
  135. autoBlur: {
  136. type: Boolean,
  137. default: () => defProps.search.autoBlur
  138. },
  139. // 输入框的样式,对象形式
  140. inputStyle: {
  141. type: Object,
  142. default: () => defProps.search.inputStyle
  143. },
  144. // 右侧控件的样式,对象形式
  145. actionStyle: {
  146. type: Object,
  147. default: () => defProps.search.actionStyle
  148. },
  149. // 自定义样式,对象形式
  150. customStyle: {
  151. type: Object,
  152. default: () => defProps.search.customStyle
  153. }
  154. }
  155. })