Commit f92ef70f4602da625428a7a924303ab2d3b3eaee
1 parent
3732707e
update DatePicker
update DatePicker
Showing
3 changed files
with
20 additions
and
3 deletions
Show diff stats
src/components/date-picker/panel/date-range.vue
... | ... | @@ -234,14 +234,29 @@ |
234 | 234 | } |
235 | 235 | }, |
236 | 236 | methods: { |
237 | + resetDate () { | |
238 | + this.date = new Date(this.date); | |
239 | + this.leftTableYear = this.date.getFullYear(); | |
240 | + this.rightTableYear = this.rightDate.getFullYear(); | |
241 | + }, | |
237 | 242 | handleClear() { |
238 | 243 | this.minDate = null; |
239 | 244 | this.maxDate = null; |
245 | + this.date = new Date(); | |
240 | 246 | this.handleConfirm(); |
241 | 247 | }, |
248 | + resetView() { | |
249 | + this.leftCurrentView = 'date'; | |
250 | + this.rightCurrentView = 'date'; | |
251 | + | |
252 | + this.leftTableYear = this.leftYear; | |
253 | + this.rightTableYear = this.rightYear; | |
254 | + }, | |
242 | 255 | prevYear (direction) { |
243 | 256 | if (this[`${direction}CurrentView`] === 'year') { |
244 | 257 | this.$refs[`${direction}YearTable`].prevTenYear(); |
258 | + } else if (this[`${direction}CurrentView`] === 'month') { | |
259 | + this[`${direction}TableYear`]--; | |
245 | 260 | } else { |
246 | 261 | const date = this.date; |
247 | 262 | date.setFullYear(date.getFullYear() - 1); |
... | ... | @@ -251,6 +266,8 @@ |
251 | 266 | nextYear (direction) { |
252 | 267 | if (this[`${direction}CurrentView`] === 'year') { |
253 | 268 | this.$refs[`${direction}YearTable`].nextTenYear(); |
269 | + } else if (this[`${direction}CurrentView`] === 'month') { | |
270 | + this[`${direction}TableYear`]--; | |
254 | 271 | } else { |
255 | 272 | const date = this.date; |
256 | 273 | date.setFullYear(date.getFullYear() + 1); | ... | ... |
src/components/date-picker/panel/date.vue
src/components/date-picker/panel/mixin.js
... | ... | @@ -13,9 +13,6 @@ export default { |
13 | 13 | handleShortcutClick (shortcut) { |
14 | 14 | if (shortcut.value) this.$emit('on-pick', shortcut.value()); |
15 | 15 | if (shortcut.onClick) shortcut.onClick(this); |
16 | - }, | |
17 | - resetDate () { | |
18 | - this.date = new Date(this.date); | |
19 | 16 | } |
20 | 17 | } |
21 | 18 | } |
22 | 19 | \ No newline at end of file | ... | ... |