Skip to content

Commit

Permalink
Merge pull request #142 from treadpit/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
todrfu authored Jul 18, 2019
2 parents 8e85b0a + 3f65316 commit 797d50b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
20 changes: 12 additions & 8 deletions src/component/calendar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ const conf = {
}

if (!Component.firstRender) {
mountEventsOnPage(getCurrentPage());
Component.triggerEvent('afterCalendarRender', Component);
Component.firstRender = true;
initialTasks.flag = 'finished';
if (initialTasks.tasks.length) {
initialTasks.tasks.shift()();
}
mountEventsOnPage(getCurrentPage());
}
},
/**
Expand Down Expand Up @@ -334,13 +334,13 @@ const conf = {
}
const selectedDay = conf.initSelectedDayWhenRender(year, month, curDate);
const selectedDayCol = selectedDay.map(
d => `${d.year}-${d.month}-${d.day}`
d => `${+d.year}-${+d.month}-${+d.day}`
);
const disableDaysCol = disableDays.map(
d => `${d.year}-${d.month}-${d.day}`
d => `${+d.year}-${+d.month}-${+d.day}`
);
days.forEach(item => {
const cur = `${item.year}-${item.month}-${item.day}`;
const cur = `${+item.year}-${+item.month}-${+item.day}`;
if (selectedDayCol.includes(cur)) item.choosed = true;
if (disableDaysCol.includes(cur)) item.disable = true;
const timestamp = newDate(item.year, item.month, item.day).getTime();
Expand Down Expand Up @@ -748,17 +748,21 @@ const conf = {
const daysCopy = days.slice();
const { selectedDay = [], todoLabels = [] } = getData('calendar');
const selectedDayStr = selectedDay.map(
item => `${item.year}+${item.month}+${item.day}`
item => `${+item.year}-${+item.month}-${+item.day}`
);
const todoLabelsCol = todoLabels.map(
d => `${+d.year}-${+d.month}-${+d.day}`
);
const todoLabelsCol = todoLabels.map(d => `${d.year}-${d.month}-${d.day}`);
daysCopy.forEach(item => {
if (selectedDayStr.includes(`${item.year}+${item.month}+${item.day}`)) {
if (
selectedDayStr.includes(`${+item.year}-${+item.month}-${+item.day}`)
) {
item.choosed = true;
} else {
item.choosed = false;
}
const idx = todoLabelsCol.indexOf(
`${item.year}-${item.month}-${item.day}`
`${+item.year}-${+item.month}-${+item.day}`
);
if (idx !== -1) {
item.showTodoLabel = !item.choosed;
Expand Down
14 changes: 4 additions & 10 deletions src/pages/calendarComponent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ const conf = {
// defaultDay: '2019-5-19'
onlyShowCurrentMonth: 1
// disablePastDay: 1
},
calendarConfig2: {
// multi: true,
// inverse: 1, // 单选模式下是否可以取消选择
defaultDay: '2019-5-20'
// disablePastDay: 1
}
},
onShow: function() {
Expand All @@ -22,21 +16,21 @@ const conf = {
const data = [
{
year: '2019',
month: '5',
month: '7',
day: '15'
},
{
year: 2019,
month: 5,
month: 8,
day: 18,
todoText: '待办'
}
];
// 异步请求
setTimeout(() => {
this.calendar.setTodoLabels({
// circle: true,
pos: 'top',
circle: true,
// pos: 'top',
days: data
});
}, 1000);
Expand Down

0 comments on commit 797d50b

Please sign in to comment.