Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

158 wiersze
3.9 KiB

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