props.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import { defineProps } from '../../libs/util/props';
  2. import theme from '../../libs/config/theme.js';
  3. export default defineProps('calendar', {
  4. // 日历顶部标题
  5. title: {
  6. type: String,
  7. default: () => uni.$u.$t('uCalendar.title')
  8. },
  9. // 是否显示标题
  10. showTitle: {
  11. type: Boolean,
  12. default: true
  13. },
  14. // 是否显示副标题
  15. showSubtitle: {
  16. type: Boolean,
  17. default: true
  18. },
  19. // 选中的日期的形状,circle(圆形),square(带圆角) (默认 'square' )
  20. shape: {
  21. type: String,
  22. default: 'square'
  23. },
  24. // 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围
  25. mode: {
  26. type: String,
  27. default: 'single'
  28. },
  29. // mode=range时,第一个日期底部的提示文字
  30. startText: {
  31. type: String,
  32. default: () => uni.$u.$t('uCalendar.startText')
  33. },
  34. // mode=range时,最后一个日期底部的提示文字
  35. endText: {
  36. type: String,
  37. default: () => uni.$u.$t('uCalendar.endText')
  38. },
  39. // 自定义列表
  40. customList: {
  41. type: Array,
  42. default: []
  43. },
  44. // 主题色,对底部按钮和选中日期有效
  45. color: {
  46. type: String,
  47. default: theme.primary
  48. },
  49. // 最小的可选日期
  50. minDate: {
  51. type: [String, Number],
  52. default: 0
  53. },
  54. // 最大可选日期
  55. maxDate: {
  56. type: [String, Number],
  57. default: 0
  58. },
  59. // 默认选中的日期,mode为multiple或range是必须为数组格式
  60. defaultDate: {
  61. type: [Array, String, Date, null],
  62. default: null
  63. },
  64. // mode=multiple时,最多可选多少个日期
  65. maxCount: {
  66. type: [String, Number],
  67. default: Number.MAX_SAFE_INTEGER
  68. },
  69. // 日期行高
  70. rowHeight: {
  71. type: [String, Number],
  72. default: 56
  73. },
  74. // 日期格式化函数
  75. formatter: {
  76. type: [Function, null],
  77. default: null
  78. },
  79. // 是否显示农历
  80. showLunar: {
  81. type: Boolean,
  82. default: false
  83. },
  84. // 是否显示月份背景色
  85. showMark: {
  86. type: Boolean,
  87. default: true
  88. },
  89. // 确定按钮的文字
  90. confirmText: {
  91. type: String,
  92. default: () => uni.$u.$t('uCalendar.confirmText')
  93. },
  94. // 确认按钮处于禁用状态时的文字
  95. confirmDisabledText: {
  96. type: String,
  97. default: () => uni.$u.$t('uCalendar.confirmDisabledText')
  98. },
  99. // 星期几
  100. weekdays: {
  101. type: String,
  102. default: () => uni.$u.$t('uCalendar.weekdays')
  103. },
  104. // 是否显示日历弹窗
  105. show: {
  106. type: Boolean,
  107. default: false
  108. },
  109. // 是否允许点击遮罩关闭日历
  110. closeOnClickOverlay: {
  111. type: Boolean,
  112. default: true
  113. },
  114. // 是否为只读状态,只读状态下禁止选择日期
  115. readonly: {
  116. type: Boolean,
  117. default: false
  118. },
  119. // 是否展示确认按钮
  120. showConfirm: {
  121. type: Boolean,
  122. default: true
  123. },
  124. // 日期区间最多可选天数,默认无限制,mode = range时有效
  125. maxRange: {
  126. type: [Number, String],
  127. default: Number.MAX_SAFE_INTEGER
  128. },
  129. // 范围选择超过最多可选天数时的提示文案,mode = range时有效
  130. rangePrompt: {
  131. type: String,
  132. default: () => uni.$u.$t('uCalendar.rangePrompt')
  133. },
  134. // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效
  135. showRangePrompt: {
  136. type: Boolean,
  137. default: true
  138. },
  139. // 是否允许日期范围的起止时间为同一天,mode = range时有效
  140. allowSameDay: {
  141. type: Boolean,
  142. default: false
  143. },
  144. // 圆角值
  145. round: {
  146. type: [Boolean, String, Number],
  147. default: 0
  148. },
  149. // 最多展示月份数量
  150. monthNum: {
  151. type: [Number, String],
  152. default: 3
  153. },
  154. // 禁止选择的日期
  155. disabledDate: {
  156. type: [Array, String, null],
  157. default: null
  158. },
  159. // 禁止选择的日期函数
  160. disabledFun: {
  161. type: [Function, null],
  162. default: null
  163. },
  164. // 是否插入模式
  165. insert: {
  166. type: Boolean,
  167. default: false
  168. }
  169. });