You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.8 KiB

4 months ago
  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. // 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致
  90. buttonSize: {
  91. type: [String, Number],
  92. default: () => defProps.numberBox.buttonSize
  93. },
  94. // 输入框和按钮的背景颜色
  95. bgColor: {
  96. type: String,
  97. default: () => defProps.numberBox.bgColor
  98. },
  99. // 指定光标于键盘的距离,避免键盘遮挡输入框,单位px
  100. cursorSpacing: {
  101. type: [String, Number],
  102. default: () => defProps.numberBox.cursorSpacing
  103. },
  104. // 是否禁用增加按钮
  105. disablePlus: {
  106. type: Boolean,
  107. default: () => defProps.numberBox.disablePlus
  108. },
  109. // 是否禁用减少按钮
  110. disableMinus: {
  111. type: Boolean,
  112. default: () => defProps.numberBox.disableMinus
  113. },
  114. // 加减按钮图标的样式
  115. iconStyle: {
  116. type: [Object, String],
  117. default: () => defProps.numberBox.iconStyle
  118. }
  119. }
  120. })