日期选择-日历(pickDateCalendar)
点击调用
---
```html
<view class="mt10 box flex">
<view class="link" data-name="dateCalendar1" bindtap="formPickCalendar" data-confirm="pickCalendarConfirm"></view>
<view class="flex0 form_title">
<text>{{ form.dateCalendar1.title }}</text>
</view>
<view class="flex1 form_content">
<text>{{ form.dateCalendar1.value }}</text>
</view>
<view class="flex0 p10 color_gray4">
<text class="peafowlIconfont peafowl-right"></text>
</view>
</view>
```
```javascript
Page({
data: {
form: {
dateCalendar1: {
title: '日历单选',// 标题,默认:请选择日期
type: 'single',// single 表示选择单个日期,multiple 表示选择多个日期,range 表示选择日期区间
currentYear: '2021',// 默认显示的年份
currentMonth: '10',// 默认显示的月份
value: ['2021/10/09'],// 选中值,single为一天,multiple为开始日期-结束日期,range为多个日期
required: true
}
}
},
// 单选选中后的回调
pickCalendarConfirm(name, value) {
let _this = this;
console.log('项目(' + name + ')选择了:' + value)
}
});
```
配置项说明
---
|属性|类型|默认值|说明|
|-|-|-|-|
|bindtap|string|formPickDate|必需,不可更改|
|data-name|string|-|必需,组件实例名|
|data-confirm|string|-|可选,确定选择后的回调,有则调用,参数:name, value|