Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

247 wiersze
7.7 KiB

  1. import { defineMixin } from '../../libs/vue'
  2. import CalendarDefaultProps from './calendar'
  3. import { registerComponentProps } from '../../libs/config/props.js'
  4. const defProps = registerComponentProps(CalendarDefaultProps)
  5. export const props = defineMixin({
  6. props: {
  7. // 日历顶部标题
  8. title: {
  9. type: String,
  10. default: () => defProps.calendar.title
  11. },
  12. // 是否显示标题
  13. showTitle: {
  14. type: Boolean,
  15. default: () => defProps.calendar.showTitle
  16. },
  17. // 是否显示副标题
  18. showSubtitle: {
  19. type: Boolean,
  20. default: () => defProps.calendar.showSubtitle
  21. },
  22. // 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围
  23. mode: {
  24. type: String,
  25. default: () => defProps.calendar.mode
  26. },
  27. // mode=range时,第一个日期底部的提示文字
  28. startText: {
  29. type: String,
  30. default: () => defProps.calendar.startText
  31. },
  32. // mode=range时,最后一个日期底部的提示文字
  33. endText: {
  34. type: String,
  35. default: () => defProps.calendar.endText
  36. },
  37. // 自定义列表
  38. customList: {
  39. type: Array,
  40. default: () => defProps.calendar.customList
  41. },
  42. // 主题色,对底部按钮和选中日期有效
  43. color: {
  44. type: String,
  45. default: () => defProps.calendar.color
  46. },
  47. // 最小的可选日期
  48. minDate: {
  49. type: [String, Number],
  50. default: () => defProps.calendar.minDate
  51. },
  52. // 最大可选日期
  53. maxDate: {
  54. type: [String, Number],
  55. default: () => defProps.calendar.maxDate
  56. },
  57. // 默认选中的日期,mode为multiple或range是必须为数组格式
  58. defaultDate: {
  59. type: [Array, String, Date, null],
  60. default: () => defProps.calendar.defaultDate
  61. },
  62. // mode=multiple时,最多可选多少个日期
  63. maxCount: {
  64. type: [String, Number],
  65. default: () => defProps.calendar.maxCount
  66. },
  67. // 日期行高
  68. rowHeight: {
  69. type: [String, Number],
  70. default: () => defProps.calendar.rowHeight
  71. },
  72. // 日期格式化函数
  73. formatter: {
  74. type: [Function, null],
  75. default: () => defProps.calendar.formatter
  76. },
  77. // 是否显示农历
  78. showLunar: {
  79. type: Boolean,
  80. default: () => defProps.calendar.showLunar
  81. },
  82. // 是否显示月份背景色
  83. showMark: {
  84. type: Boolean,
  85. default: () => defProps.calendar.showMark
  86. },
  87. // 确定按钮的文字
  88. confirmText: {
  89. type: String,
  90. default: () => defProps.calendar.confirmText
  91. },
  92. // 确认按钮处于禁用状态时的文字
  93. confirmDisabledText: {
  94. type: String,
  95. default: () => defProps.calendar.confirmDisabledText
  96. },
  97. // 是否显示日历弹窗
  98. show: {
  99. type: Boolean,
  100. default: () => defProps.calendar.show
  101. },
  102. // 是否显示遮罩
  103. overlay: {
  104. type: Boolean,
  105. default: () => defProps.calendar.overlay
  106. },
  107. // 动画时长,单位ms
  108. duration: {
  109. type: [String, Number],
  110. default: () => defProps.calendar.duration
  111. },
  112. // 自定义遮罩的样式
  113. overlayStyle: {
  114. type: [Object, String],
  115. default: () => defProps.calendar.overlayStyle
  116. },
  117. // 遮罩的透明度,0-1之间
  118. overlayOpacity: {
  119. type: [Number, String],
  120. default: () => defProps.calendar.overlayOpacity
  121. },
  122. // 层级
  123. zIndex: {
  124. type: [String, Number],
  125. default: () => defProps.calendar.zIndex
  126. },
  127. // 是否为iPhoneX留出底部安全距离
  128. safeAreaInsetBottom: {
  129. type: Boolean,
  130. default: () => defProps.calendar.safeAreaInsetBottom
  131. },
  132. // 是否留出顶部安全距离(状态栏高度)
  133. safeAreaInsetTop: {
  134. type: Boolean,
  135. default: () => defProps.calendar.safeAreaInsetTop
  136. },
  137. // 弹窗背景色,设置为transparent可去除白色背景
  138. bgColor: {
  139. type: String,
  140. default: () => defProps.calendar.bgColor
  141. },
  142. // 是否允许点击遮罩关闭日历
  143. closeOnClickOverlay: {
  144. type: Boolean,
  145. default: () => defProps.calendar.closeOnClickOverlay
  146. },
  147. // 是否为只读状态,只读状态下禁止选择日期
  148. readonly: {
  149. type: Boolean,
  150. default: () => defProps.calendar.readonly
  151. },
  152. // 是否展示确认按钮
  153. showConfirm: {
  154. type: Boolean,
  155. default: () => defProps.calendar.showConfirm
  156. },
  157. // 日期区间最多可选天数,默认无限制,mode = range时有效
  158. maxRange: {
  159. type: [Number, String],
  160. default: () => defProps.calendar.maxRange
  161. },
  162. // 范围选择超过最多可选天数时的提示文案,mode = range时有效
  163. rangePrompt: {
  164. type: String,
  165. default: () => defProps.calendar.rangePrompt
  166. },
  167. // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效
  168. showRangePrompt: {
  169. type: Boolean,
  170. default: () => defProps.calendar.showRangePrompt
  171. },
  172. // 是否允许日期范围的起止时间为同一天,mode = range时有效
  173. allowSameDay: {
  174. type: Boolean,
  175. default: () => defProps.calendar.allowSameDay
  176. },
  177. // 区间模式下确认返回值格式,all-返回区间内所有日期,boundary-仅返回起止日期
  178. rangeResultMode: {
  179. type: String,
  180. default: () => defProps.calendar.rangeResultMode
  181. },
  182. // 是否开启时分秒选择
  183. enableTime: {
  184. type: Boolean,
  185. default: () => defProps.calendar.enableTime
  186. },
  187. // 时间精度:hour-仅时,minute-时分,second-时分秒
  188. timePrecision: {
  189. type: String,
  190. default: () => defProps.calendar.timePrecision
  191. },
  192. // 默认时间,格式支持 HH / HH:mm / HH:mm:ss
  193. defaultTime: {
  194. type: String,
  195. default: () => defProps.calendar.defaultTime
  196. },
  197. // 圆角值
  198. round: {
  199. type: [Boolean, String, Number],
  200. default: () => defProps.calendar.round
  201. },
  202. // 最多展示月份数量
  203. monthNum: {
  204. type: [Number, String],
  205. default: 3
  206. },
  207. // 是否启用非滚动的单月切换模式
  208. monthSwitch: {
  209. type: Boolean,
  210. default: () => defProps.calendar.monthSwitch
  211. },
  212. // 是否显示今天按钮
  213. showToday: {
  214. type: Boolean,
  215. default: () => defProps.calendar.showToday
  216. },
  217. // 今天日期的独立高亮颜色,默认跟随主题色
  218. todayColor: {
  219. type: String,
  220. default: () => defProps.calendar.todayColor
  221. },
  222. // 星期文案
  223. weekText: {
  224. type: Array,
  225. default: defProps.calendar.weekText
  226. },
  227. forbidDays: {
  228. type: Array,
  229. default: defProps.calendar.forbidDays
  230. },
  231. forbidDaysToast:{
  232. type: String,
  233. default: defProps.calendar.forbidDaysToast
  234. },
  235. monthFormat:{
  236. type: String,
  237. default: defProps.calendar.monthFormat
  238. },
  239. // 是否页面内展示
  240. pageInline:{
  241. type: Boolean,
  242. default: defProps.calendar.pageInline
  243. }
  244. }
  245. })