3
0

props.js 4.2 KB

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