Calendar

Calendar

Property

Description

Type

Default

Required

type

Selection type single

: Single date range

: Date range.

String 

single

No

tagData

Tag data, including date

, tag

, disable

or not, tag color tagColor

. The tagColor includes   1.#f5a911, 2.#e8541e, 3.#07a89b 4.#108ee9 and 5.#b5b5b5.

Array<date, tag, tagColor>

No

onSelect

Select range callback.

([startDate,   endDate]) => void

No

onMonthChange

Callback on clicking month change, including two parameters currentMonth (change to next month) and prevMonth (change to previous month).

(currentMonth,   prevMonth) => void

No

onSelectHasDisableDate

Selected range includes unusable date.

(currentMonth,   prevMonth) => void

No

Example

copy
{
  "defaultTitle": "AntUI Component Library",
  "usingComponents":{
    "calendar": "mini-antui/es/calendar/index"
  }
}
copy
<view>
  <calendar
    type="single"
    tagData="{{tagData}}"
    onSelect="handleSelect" />
</view>
copy
Page({
  data: {
    tagData: [
      { date: '2018-05-14', tag: 'Returning mortgage', tagColor: 5 },
      { date: '2018-05-28', tag: 'Provident fund', tagColor: 2 },
    ],
  },
  handleSelect() {},
  onMonthChange() {},
});