diff --git a/README.md b/README.md
index 15a8521..2c01fb8 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ const conf = {
Page(conf);
```
-更多配置及功能请 [参考文档](https://treadpit.github.io)
+更多配置及功能请 [参考文档](http://calendar.isfeer.com)
### 日历模板效果图
diff --git a/docs/README.md b/docs/README.md
index df59dfa..3d10b3f 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -140,8 +140,11 @@ import { setTodoLabels } from '../../template/calendar/index';
// 待办事项中若有 todoText 字段,则会在待办日期下面显示指定文字,如自定义节日等。
setTodoLabels({
- pos: 'bottom',
- dotColor: '#40',
+ // 待办点标记设置
+ pos: 'bottom', // 待办点标记位置 ['top', 'bottom']
+ dotColor: '#40', // 待办点标记颜色
+ // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥
+ circle: true, // 待办
days: [{
year: 2018,
month: 1,
@@ -179,6 +182,13 @@ import { clearTodoLabels } from '../../template/calendar/index';
clearTodoLabels();
```
+##### 6.4 获取所有代办日期
+```js
+import { getTodoLabels } from '../../template/calendar/index';
+
+getTodoLabels();
+```
+
#### 7. 禁选指定日期
```js
diff --git a/docs/index.html b/docs/index.html
index b663b8e..08ecf83 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -14,7 +14,7 @@
diff --git a/src/component/calendar/index.wxml b/src/component/calendar/index.wxml
index 06edc7e..c24b902 100644
--- a/src/component/calendar/index.wxml
+++ b/src/component/calendar/index.wxml
@@ -29,11 +29,14 @@
data-disable="{{item.disable}}"
data-idx="{{index}}"
bindtap="tapDayItem">
-
+
{{item.todoText}}
- {{item.day}}
+ {{item.day}}
{{item.todoText}}
+
+ {{item.day}}
+
+item.year === curYear && +item.month === curMonth
@@ -510,9 +515,13 @@ const conf = {
'calendar.days': days,
'calendar.todoLabels': uniqueTodoLabels(todoDays.concat(todoLabels))
};
- if (pos && pos !== todoLabelPos) o['calendar.todoLabelPos'] = pos;
- if (dotColor && dotColor !== todoLabelColor) {
- o['calendar.todoLabelColor'] = dotColor;
+ if (!circle) {
+ if (pos && pos !== todoLabelPos) o['calendar.todoLabelPos'] = pos;
+ if (dotColor && dotColor !== todoLabelColor) {
+ o['calendar.todoLabelColor'] = dotColor;
+ }
+ } else {
+ o['calendar.todoLabelCircle'] = circle;
}
this.setData(o);
},
@@ -1016,6 +1025,12 @@ export const deleteTodoLabels = todos => {
export const clearTodoLabels = () => {
conf.clearTodoLabels.call(currentPage);
};
+/**
+ * 获取所有 TODO 日期
+ */
+export const getTodoLabels = () => {
+ return currentPage && currentPage.data.calendar.todoLabels;
+};
/**
* 切换周月视图
* @param {string} view 视图模式[week, month]
diff --git a/src/pages/calendar/index.wxml b/src/pages/calendar/index.wxml
index 26052da..afd275e 100644
--- a/src/pages/calendar/index.wxml
+++ b/src/pages/calendar/index.wxml
@@ -16,7 +16,7 @@
- {{item.day}}
+ {{item.day}}
diff --git a/src/pages/calendar/index.wxss b/src/pages/calendar/index.wxss
index b171c9a..940f400 100644
--- a/src/pages/calendar/index.wxss
+++ b/src/pages/calendar/index.wxss
@@ -187,7 +187,7 @@ page {
color: #fff;
}
-.pink-bg {
+.day-choosed-bg {
background-color: #ff629a;
}
diff --git a/src/pages/calendarTemplate/index.js b/src/pages/calendarTemplate/index.js
index c0ce09c..55e6bf5 100644
--- a/src/pages/calendarTemplate/index.js
+++ b/src/pages/calendarTemplate/index.js
@@ -46,12 +46,12 @@ const conf = {
const data = [
{
year: '2019',
- month: '1',
+ month: '2',
day: '15'
},
{
year: 2019,
- month: 1,
+ month: 2,
day: 18,
todoText: '待办'
}
@@ -61,6 +61,7 @@ const conf = {
setTodoLabels({
pos: 'bottom',
dotColor: '#40',
+ circle: true,
days: data
});
disableDay(1);
diff --git a/src/pages/index/index.wxml b/src/pages/index/index.wxml
index 4dd6125..1d174db 100644
--- a/src/pages/index/index.wxml
+++ b/src/pages/index/index.wxml
@@ -1,9 +1,8 @@
- 示例目前有独立页面和 template 两种模式,
+ 日历控件目前有 Component 和 template 两种方式引入,
引入方法见 README
- 日历控件template 示例
- 日历控件Component 示例
- 日期选择器template 示例
- 日历独立页面(不维护)
+ 日历控件 Template 示例
+ 日历控件 Component 示例
+ 日期选择器 Template 示例
\ No newline at end of file
diff --git a/src/template/calendar/index.js b/src/template/calendar/index.js
index 42431ed..329e9ba 100644
--- a/src/template/calendar/index.js
+++ b/src/template/calendar/index.js
@@ -548,7 +548,12 @@ const conf = {
}
const days = calendar.days.slice();
const { curYear, curMonth } = calendar;
- const { days: todoDays = [], pos = 'bottom', dotColor = '' } = options;
+ const {
+ days: todoDays = [],
+ pos = 'bottom',
+ dotColor = '',
+ circle
+ } = options;
const { todoLabels = [], todoLabelPos, todoLabelColor } = calendar;
const shouldMarkerTodoDay = todoDays.filter(
item => +item.year === curYear && +item.month === curMonth
@@ -571,9 +576,13 @@ const conf = {
'calendar.days': days,
'calendar.todoLabels': uniqueTodoLabels(todoDays.concat(todoLabels))
};
- if (pos && pos !== todoLabelPos) o['calendar.todoLabelPos'] = pos;
- if (dotColor && dotColor !== todoLabelColor) {
- o['calendar.todoLabelColor'] = dotColor;
+ if (!circle) {
+ if (pos && pos !== todoLabelPos) o['calendar.todoLabelPos'] = pos;
+ if (dotColor && dotColor !== todoLabelColor) {
+ o['calendar.todoLabelColor'] = dotColor;
+ }
+ } else {
+ o['calendar.todoLabelCircle'] = circle;
}
this.setData(o);
},
@@ -1111,6 +1120,12 @@ export const deleteTodoLabels = todos => {
export const clearTodoLabels = () => {
conf.clearTodoLabels.call(currentPage);
};
+/**
+ * 获取所有 TODO 日期
+ */
+export const getTodoLabels = () => {
+ return currentPage && currentPage.data.calendar.todoLabels;
+};
/**
* 切换周月视图
* @param {string} view 视图模式[week, month]
diff --git a/src/template/calendar/index.wxml b/src/template/calendar/index.wxml
index df55451..229d3f1 100644
--- a/src/template/calendar/index.wxml
+++ b/src/template/calendar/index.wxml
@@ -30,11 +30,14 @@
data-disable="{{item.disable}}"
data-idx="{{index}}"
bindtap="tapDayItem">
-
+
{{item.todoText}}
- {{item.day}}
+ {{item.day}}
{{item.todoText}}
+
+ {{item.day}}
+
- {{item.day}}
+ {{item.day}}