props.js 1.9 KB

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