Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

78 linhas
2.3 KiB

  1. import { defineMixin } from '../../libs/vue'
  2. import SwitchDefaultProps from './switch'
  3. import { registerComponentProps } from '../../libs/config/props.js'
  4. const defProps = registerComponentProps(SwitchDefaultProps)
  5. export const props = defineMixin({
  6. props: {
  7. // 是否为加载中状态
  8. loading: {
  9. type: Boolean,
  10. default: () => defProps.switch.loading
  11. },
  12. // 是否为禁用装填
  13. disabled: {
  14. type: Boolean,
  15. default: () => defProps.switch.disabled
  16. },
  17. // 开关尺寸,单位px
  18. size: {
  19. type: [String, Number],
  20. default: () => defProps.switch.size
  21. },
  22. // 打开时的背景颜色
  23. activeColor: {
  24. type: String,
  25. default: () => defProps.switch.activeColor
  26. },
  27. // 关闭时的背景颜色
  28. inactiveColor: {
  29. type: String,
  30. default: () => defProps.switch.inactiveColor
  31. },
  32. // 打开时圆点的颜色
  33. dotActiveColor: {
  34. type: String,
  35. default: () => defProps.switch.dotActiveColor
  36. },
  37. // 关闭时圆点的颜色
  38. dotInactiveColor: {
  39. type: String,
  40. default: () => defProps.switch.dotInactiveColor
  41. },
  42. // 通过v-model双向绑定的值
  43. // #ifdef VUE3
  44. modelValue: {
  45. type: [Boolean, String, Number],
  46. default: () => defProps.switch.value
  47. },
  48. // #endif
  49. // #ifdef VUE2
  50. value: {
  51. type: [Boolean, String, Number],
  52. default: () => defProps.switch.value
  53. },
  54. // #endif
  55. // switch打开时的值
  56. activeValue: {
  57. type: [String, Number, Boolean],
  58. default: () => defProps.switch.activeValue
  59. },
  60. // switch关闭时的值
  61. inactiveValue: {
  62. type: [String, Number, Boolean],
  63. default: () => defProps.switch.inactiveValue
  64. },
  65. // 是否开启异步变更,开启后需要手动控制输入值
  66. asyncChange: {
  67. type: Boolean,
  68. default: () => defProps.switch.asyncChange
  69. },
  70. // 圆点与外边框的距离
  71. space: {
  72. type: [String, Number],
  73. default: () => defProps.switch.space
  74. }
  75. }
  76. })