props.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { defineMixin } from '../../libs/vue'
  2. import defProps from '../../libs/config/props.js'
  3. export const props = defineMixin({
  4. props: {
  5. // 步进器标识符,在change回调返回
  6. name: {
  7. type: [String, Number],
  8. default: () => defProps.numberBox.name
  9. },
  10. // #ifdef VUE2
  11. // 用于双向绑定的值,初始化时设置设为默认min值(最小值)
  12. value: {
  13. type: [String, Number],
  14. default: () => defProps.numberBox.value
  15. },
  16. // #endif
  17. // #ifdef VUE3
  18. // 用于双向绑定的值,初始化时设置设为默认min值(最小值)
  19. modelValue: {
  20. type: [String, Number],
  21. default: () => defProps.numberBox.value
  22. },
  23. // #endif
  24. // 最小值
  25. min: {
  26. type: [String, Number],
  27. default: () => defProps.numberBox.min
  28. },
  29. // 最大值
  30. max: {
  31. type: [String, Number],
  32. default: () => defProps.numberBox.max
  33. },
  34. // 加减的步长,可为小数
  35. step: {
  36. type: [String, Number],
  37. default: () => defProps.numberBox.step
  38. },
  39. // 是否只允许输入整数
  40. integer: {
  41. type: Boolean,
  42. default: () => defProps.numberBox.integer
  43. },
  44. // 是否禁用,包括输入框,加减按钮
  45. disabled: {
  46. type: Boolean,
  47. default: () => defProps.numberBox.disabled
  48. },
  49. // 是否禁用输入框
  50. disabledInput: {
  51. type: Boolean,
  52. default: () => defProps.numberBox.disabledInput
  53. },
  54. // 是否开启异步变更,开启后需要手动控制输入值
  55. asyncChange: {
  56. type: Boolean,
  57. default: () => defProps.numberBox.asyncChange
  58. },
  59. // 输入框宽度,单位为px
  60. inputWidth: {
  61. type: [String, Number],
  62. default: () => defProps.numberBox.inputWidth
  63. },
  64. // 是否显示减少按钮
  65. showMinus: {
  66. type: Boolean,
  67. default: () => defProps.numberBox.showMinus
  68. },
  69. // 是否显示增加按钮
  70. showPlus: {
  71. type: Boolean,
  72. default: () => defProps.numberBox.showPlus
  73. },
  74. // 显示的小数位数
  75. decimalLength: {
  76. type: [String, Number, null],
  77. default: () => defProps.numberBox.decimalLength
  78. },
  79. // 是否开启长按加减手势
  80. longPress: {
  81. type: Boolean,
  82. default: () => defProps.numberBox.longPress
  83. },
  84. // 输入框文字和加减按钮图标的颜色
  85. color: {
  86. type: String,
  87. default: () => defProps.numberBox.color
  88. },
  89. // 按钮宽度
  90. buttonWidth: {
  91. type: [String, Number],
  92. default: () => defProps.numberBox.buttonWidth
  93. },
  94. // 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致
  95. buttonSize: {
  96. type: [String, Number],
  97. default: () => defProps.numberBox.buttonSize
  98. },
  99. // 按钮圆角
  100. buttonRadius: {
  101. type: [String],
  102. default: () => defProps.numberBox.buttonRadius
  103. },
  104. // 输入框和按钮的背景颜色
  105. bgColor: {
  106. type: String,
  107. default: () => defProps.numberBox.bgColor
  108. },
  109. // 输入框背景颜色
  110. inputBgColor: {
  111. type: String,
  112. default: () => defProps.numberBox.inputBgColor
  113. },
  114. // 指定光标于键盘的距离,避免键盘遮挡输入框,单位px
  115. cursorSpacing: {
  116. type: [String, Number],
  117. default: () => defProps.numberBox.cursorSpacing
  118. },
  119. // 是否禁用增加按钮
  120. disablePlus: {
  121. type: Boolean,
  122. default: () => defProps.numberBox.disablePlus
  123. },
  124. // 是否禁用减少按钮
  125. disableMinus: {
  126. type: Boolean,
  127. default: () => defProps.numberBox.disableMinus
  128. },
  129. // 加减按钮图标的样式
  130. iconStyle: {
  131. type: [Object, String],
  132. default: () => defProps.numberBox.iconStyle
  133. },
  134. // 迷你模式
  135. miniMode: {
  136. type: Boolean,
  137. default: () => defProps.numberBox.miniMode
  138. },
  139. }
  140. })