Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

fix bug: Calendar未支持文档中写的closeByOutsideClick属性 #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/js/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
var valueDate = new Date(p.value[i]);
p.wrapper.find('.picker-calendar-day[data-date="' + valueDate.getFullYear() + '-' + valueDate.getMonth() + '-' + valueDate.getDate() + '"]').addClass('picker-calendar-day-selected');
}
if (p.params.onChange) {
p.params.onChange(p, p.value, p.value.map(formatDate));
}
if (p.input && p.input.length > 0) {
if (p.params.formatValue) inputValue = p.params.formatValue(p, p.value);
else {
Expand All @@ -123,6 +120,9 @@
$(p.input).val(inputValue);
$(p.input).trigger('change');
}
if (p.params.onChange) {
p.params.onChange(p, p.value, p.value.map(formatDate));
}
};

// Columns Handlers
Expand Down Expand Up @@ -678,7 +678,7 @@
}

//iphone 上无法正确触发 click,会导致点击外面无法关闭
if (!p.inline) $(document).on('click touchend', closeOnHTMLClick);
if (!p.inline && p.params.closeByOutsideClick) $(document).on('click touchend', closeOnHTMLClick);

// Open
function onPickerClose() {
Expand Down Expand Up @@ -827,6 +827,7 @@
touchMove: true,
animate: true,
closeOnSelect: true,
closeByOutsideClick: true,
monthPicker: true,
monthPickerTemplate:
'<div class="picker-calendar-month-picker">' +
Expand Down