小程序日历组件

小程序日历组件

闲来没事把以前想作的日历组件给作了 先上图git

参数

参数 类型 说明 默认值
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 在选择日期时触发,返回选中的日期

示例github

index.wxmljson

<calendar today="{{true}}" bind:select="select"></calendar>
复制代码

index.json小程序

"usingComponents": {
        "calendar": "../../../components/calendar/index"
    }
复制代码

index.jsbash

select(e) {
        console.log(e)
    },
复制代码

返回选中的日期 e.detail.valueui

详细代码看github github
相关文章
相关标签/搜索