fix: 修复bug #6404

This commit is contained in:
msidolphin 2020-01-17 12:20:07 +08:00
parent 50ebddc7c9
commit 5c7cde1b8c
2 changed files with 13 additions and 4 deletions

View file

@ -250,7 +250,7 @@
<template> <template>
<div style="width: 500px;margin: 100px;"> <div style="width: 500px;margin: 100px;">
<p><input type="text"></p> <p><input type="text"></p>
<DatePicker type="month" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker> <DatePicker type="month" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker>
<DatePicker type="year" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker> <DatePicker type="year" show-week-numbers placeholder="Select date" style="width: 200px"></DatePicker>
@ -260,6 +260,8 @@
<DatePicker type="daterange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker> <DatePicker type="daterange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker>
<DatePicker type="datetimerange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker> <DatePicker type="datetimerange" transfer show-week-numbers placeholder="Select date" style="width: 400px"></DatePicker>
<Time-Picker :steps="[1, 1, 15]" :value="new Date()"></Time-Picker> <Time-Picker :steps="[1, 1, 15]" :value="new Date()"></Time-Picker>
<DatePicker type="daterange" split-panels placeholder="Select date" style="width: 200px"></DatePicker>
</div> </div>
</template> </template>
<script> <script>

View file

@ -296,11 +296,18 @@
}, },
changePanelDate(panel, type, increment, updateOtherPanel = true){ changePanelDate(panel, type, increment, updateOtherPanel = true){
const current = new Date(this[`${panel}PanelDate`]); const current = new Date(this[`${panel}PanelDate`]);
if (panel === 'left') {
current[`set${type}`](current[`get${type}`](), 0); if (this.splitPanels) {
} else { // fix #6404
current[`set${type}`](current[`get${type}`]() + increment); current[`set${type}`](current[`get${type}`]() + increment);
} else {
if (panel === 'left') {
current[`set${type}`](current[`get${type}`]() + increment);
} else {
current[`set${type}`](current[`get${type}`]() + increment);
}
} }
this[`${panel}PanelDate`] = current; this[`${panel}PanelDate`] = current;
if (!updateOtherPanel) return; if (!updateOtherPanel) return;