程序日历组件
闲来没事把之前想做的日历组件给做了 先上图

参数
参数 |
类型 |
说明 |
默认值 |
header |
Boolean |
是否显示头部操作栏 |
true |
preMonth |
Boolean |
是否显示上个月按钮 |
true |
nextMonth |
Boolean |
是否显示下个月按钮 |
true |
preYear |
Boolean |
是否显示上一年按钮 |
false |
nextYear |
Boolean |
是否显示下一年按钮 |
false |
today |
Boolean |
是否显示今天按钮 |
false |
weeks |
Boolean |
是否显示周标题 |
true |
weeksType |
String |
周标题类型 |
cn |
showMoreDays |
Boolean |
是否显示前后月份残余数据 |
false |
formatType |
String |
日期连接符 |
- |
事件
事件名称 |
说明 |
select |
在选择日期时触发,返回选中的日期 |
示例
index.wxml
<calendar today="{{true}}" bind:select="select"></calendar>
复制代码
index.json
"usingComponents": {
"calendar": "../../../components/calendar/index"
}
复制代码
index.js
select(e) {
console.log(e)
},
复制代码
返回选中的日期 e.detail.value

详细代码看github
github |