小程序日曆組件

小程序日曆組件

閒來沒事把以前想作的日曆組件給作了 先上圖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
相關文章
相關標籤/搜索