props.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import { defineMixin } from '../../libs/vue'
  2. import defProps from '../../libs/config/props.js'
  3. export const props = defineMixin({
  4. props: {
  5. // 是否显示input
  6. hasInput: {
  7. type: Boolean,
  8. default: () => false
  9. },
  10. placeholder: {
  11. type: String,
  12. default: () => '请选择'
  13. },
  14. format: {
  15. type: String,
  16. default: () => ''
  17. },
  18. // 是否打开组件
  19. show: {
  20. type: Boolean,
  21. default: () => defProps.datetimePicker.show
  22. },
  23. // 弹出的方向,可选值为 top bottom right left center
  24. popupMode: {
  25. type: String,
  26. default: () => defProps.picker.popupMode
  27. },
  28. // 是否展示顶部的操作栏
  29. showToolbar: {
  30. type: Boolean,
  31. default: () => defProps.datetimePicker.showToolbar
  32. },
  33. // 工具栏右侧内容
  34. toolbarRightSlot:{
  35. type: Boolean,
  36. default: false
  37. },
  38. // #ifdef VUE2
  39. // 绑定值
  40. value: {
  41. type: [String, Number],
  42. default: () => defProps.datetimePicker.value
  43. },
  44. // #endif
  45. // #ifdef VUE3
  46. // 绑定值
  47. modelValue: {
  48. type: [String, Number],
  49. default: () => defProps.datetimePicker.value
  50. },
  51. // #endif
  52. // 顶部标题
  53. title: {
  54. type: String,
  55. default: () => defProps.datetimePicker.title
  56. },
  57. // 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择
  58. mode: {
  59. type: String,
  60. default: () => defProps.datetimePicker.mode
  61. },
  62. // 可选的最大时间
  63. maxDate: {
  64. type: Number,
  65. // 最大默认值为后10年
  66. default: () => defProps.datetimePicker.maxDate
  67. },
  68. // 可选的最小时间
  69. minDate: {
  70. type: Number,
  71. // 最小默认值为前10年
  72. default: () => defProps.datetimePicker.minDate
  73. },
  74. // 可选的最小小时,仅mode=time有效
  75. minHour: {
  76. type: Number,
  77. default: () => defProps.datetimePicker.minHour
  78. },
  79. // 可选的最大小时,仅mode=time有效
  80. maxHour: {
  81. type: Number,
  82. default: () => defProps.datetimePicker.maxHour
  83. },
  84. // 可选的最小分钟,仅mode=time有效
  85. minMinute: {
  86. type: Number,
  87. default: () => defProps.datetimePicker.minMinute
  88. },
  89. // 可选的最大分钟,仅mode=time有效
  90. maxMinute: {
  91. type: Number,
  92. default: () => defProps.datetimePicker.maxMinute
  93. },
  94. // 选项过滤函数
  95. filter: {
  96. type: [Function, null],
  97. default: () => defProps.datetimePicker.filter
  98. },
  99. // 选项格式化函数
  100. formatter: {
  101. type: [Function, null],
  102. default: () => defProps.datetimePicker.formatter
  103. },
  104. // 是否显示加载中状态
  105. loading: {
  106. type: Boolean,
  107. default: () => defProps.datetimePicker.loading
  108. },
  109. // 各列中,单个选项的高度
  110. itemHeight: {
  111. type: [String, Number],
  112. default: () => defProps.datetimePicker.itemHeight
  113. },
  114. // 取消按钮的文字
  115. cancelText: {
  116. type: String,
  117. default: () => defProps.datetimePicker.cancelText
  118. },
  119. // 确认按钮的文字
  120. confirmText: {
  121. type: String,
  122. default: () => defProps.datetimePicker.confirmText
  123. },
  124. // 取消按钮的颜色
  125. cancelColor: {
  126. type: String,
  127. default: () => defProps.datetimePicker.cancelColor
  128. },
  129. // 确认按钮的颜色
  130. confirmColor: {
  131. type: String,
  132. default: () => defProps.datetimePicker.confirmColor
  133. },
  134. // 每列中可见选项的数量
  135. visibleItemCount: {
  136. type: [String, Number],
  137. default: () => defProps.datetimePicker.visibleItemCount
  138. },
  139. // 是否允许点击遮罩关闭选择器
  140. closeOnClickOverlay: {
  141. type: Boolean,
  142. default: () => defProps.datetimePicker.closeOnClickOverlay
  143. },
  144. // 各列的默认索引
  145. defaultIndex: {
  146. type: Array,
  147. default: () => defProps.datetimePicker.defaultIndex
  148. }
  149. }
  150. })