update DateTimePicker
update DateTimePicker
This commit is contained in:
parent
d596b9e4f8
commit
5cc9b892b8
8 changed files with 98 additions and 21 deletions
|
@ -1,5 +1,9 @@
|
|||
<template>
|
||||
<div :class="[prefixCls + '-confirm']">
|
||||
<span v-if="showTime" @click="handleToggleTime">
|
||||
<template v-if="isTime">选择日期</template>
|
||||
<template v-else>选择时间</template>
|
||||
</span>
|
||||
<i-button size="small" type="text" @click="handleClear">清空</i-button>
|
||||
<i-button size="small" type="primary" @click="handleSuccess">确定</i-button>
|
||||
</div>
|
||||
|
@ -11,6 +15,10 @@
|
|||
|
||||
export default {
|
||||
components: { iButton },
|
||||
props: {
|
||||
showTime: false,
|
||||
isTime: false
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
prefixCls: prefixCls
|
||||
|
@ -22,6 +30,9 @@
|
|||
},
|
||||
handleSuccess () {
|
||||
this.$emit('on-pick-success');
|
||||
},
|
||||
handleToggleTime () {
|
||||
this.$emit('on-pick-toggle-time');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -168,6 +168,11 @@
|
|||
let month = this.month;
|
||||
let day = cell.text;
|
||||
|
||||
const date = this.date;
|
||||
const hours = date.getHours();
|
||||
const minutes = date.getMinutes();
|
||||
const seconds = date.getSeconds();
|
||||
|
||||
if (cell.type === 'prev-month') {
|
||||
if (month === 0) {
|
||||
month = 11;
|
||||
|
@ -184,7 +189,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
return new Date(year, month, day);
|
||||
return new Date(year, month, day, hours, minutes, seconds);
|
||||
},
|
||||
handleClick (event) {
|
||||
const target = event.target;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue