diff --git "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.js" "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.js" index 37b11dc..be8c3e9 100644 --- "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.js" +++ "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.js" @@ -19,6 +19,8 @@ Page({ style: [], activeType: 'rounded', // 日期背景效果 + + bottom:false,//底部文字显示与隐藏 }, onLoad: function () { @@ -111,11 +113,11 @@ Page({ } else { this.setData({ style: [ - { month: 'current', day: 3, color: 'white', background: '#58cc69' }, - { month: 'current', day: 12, color: 'white', background: '#728eff' }, - { month: 'current', day: 13, color: 'white', background: '#728eff' }, - { month: 'current', day: 14, color: 'white', background: '#728eff' }, - { month: 'current', day: 15, color: 'white', background: '#728eff' }, + { month: 'current', day: 3, color: 'white', background: '#58cc69', bottomText: '售罄', fontSize: '20rpx' }, + { month: 'current', day: 12, color: 'white', background: '#728eff' }, + { month: 'current', day: 13, color: 'white', background: '#728eff' }, + { month: 'current', day: 14, color: 'white', background: '#728eff', bottomText: '已签到', fontSize:'20rpx' }, + { month: 'current', day: 15, color: 'white', background: '#58cc69', bottomText: '未签到', fontSize: '20rpx' }, { month: 'current', day: 16, color: 'white', background: '#728eff' }, { month: 'current', day: 26, color: 'white', background: '#ff72a6' }, { month: 'current', day: 27, color: 'white', background: '#ff72a6' }, @@ -124,6 +126,12 @@ Page({ } }, + switchBottom:function(){ + this.setData({ + bottom: !this.data.bottom + }); + }, + changeTitle: function (event) { const index = event.detail.value; switch (index) { diff --git "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.wxml" "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.wxml" index 939bcb6..51e59d5 100644 --- "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.wxml" +++ "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/miniprogram/pages/index/index.wxml" @@ -35,6 +35,8 @@ actives:[激活的日期] days-color="{{style}}" active-type="{{activeType}}" next-month='hi' + + bottom='{{bottom}}' bindnextMonth='nextMonth' bindprevMonth='prevMonth' @@ -83,4 +85,8 @@ actives:[激活的日期] 圆形 方形 + +
+

显示底部文字

+
\ No newline at end of file diff --git "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.js" "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.js" index 9679bfa..2af997f 100644 --- "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.js" +++ "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.js" @@ -16,7 +16,7 @@ * 12、cellSize: 单元格大小 整型 * 13、daysColor:设置日期字体、背景颜色 * 14、activeType: 日期背景效果(正方形、圆形)[rounded, square] - * + * 15、bottom: 是否显示日期底部文字 * 事件方法: * 1、nextMonth:点击下个月 * 2、prevMonth:点击上个月 @@ -168,7 +168,16 @@ Component({ type: Boolean, value: false, observer: '_showLunar' - } + }, + + /** + * 是否显示日期底部文字 + */ + bottom: { + type: Boolean, + value: false, + observer: '_showBottom' + } }, /** @@ -378,12 +387,22 @@ Component({ this.setData({ lunar: !!newConfig }); - }, + }, + + /** + * 是否显示底部 + */ + _showBottom: function (newConfig, oldConfig) { + this.setData({ + bottom: !!newConfig + }); + }, /** * 设置日期单元格字体颜色、背景 */ _setDaysColor: function (newDaysColor, oldDaysColor) { + console.log(newDaysColor); this.setData({ days_color: newDaysColor }, function () { @@ -509,7 +528,12 @@ Component({ } if (item.background) { days[j].background = item.background + '!important'; - } + } + ['bottomText', 'bottomColor', 'fontSize'].forEach((attr) => { + if (item[attr]) { + days[j][attr] = item[attr]; + } + }); } } } diff --git "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.wxml" "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.wxml" index d16fb3c..e799fa4 100644 --- "a/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.wxml" +++ "b/\346\217\222\344\273\266\345\274\200\345\217\221\344\273\243\347\240\201/plugin/components/calendar/calendar.wxml" @@ -54,7 +54,8 @@ {{day.day}} {{day.lunarDay}} - + + {{day.bottomText}}