bugfix: 修复H5日期组件返回的值缺少秒的问题
This commit is contained in:
parent
80909dfd4d
commit
2d3253ba0e
@ -55,6 +55,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
import { Field, Popup, DatePicker, TimePicker } from 'vant'
|
import { Field, Popup, DatePicker, TimePicker } from 'vant'
|
||||||
|
import { formatDate } from '@shared/utils'
|
||||||
|
|
||||||
// Props 定义
|
// Props 定义
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -141,6 +142,11 @@ const props = defineProps({
|
|||||||
return option
|
return option
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 返回结果格式化
|
||||||
|
resultFormat: {
|
||||||
|
type: String,
|
||||||
|
default: 'YYYY-MM-DD HH:mm:ss'
|
||||||
|
},
|
||||||
// 选项过滤函数
|
// 选项过滤函数
|
||||||
filter: {
|
filter: {
|
||||||
type: Function,
|
type: Function,
|
||||||
@ -350,13 +356,14 @@ const formatTimePart = () => {
|
|||||||
// 确认选择
|
// 确认选择
|
||||||
const onConfirm = () => {
|
const onConfirm = () => {
|
||||||
let finalValue = formatDatePart()
|
let finalValue = formatDatePart()
|
||||||
|
|
||||||
if (hasTime.value) {
|
if (hasTime.value) {
|
||||||
const timePart = formatTimePart()
|
const timePart = formatTimePart()
|
||||||
if (timePart) {
|
if (timePart) {
|
||||||
finalValue += ' ' + timePart
|
finalValue += ' ' + timePart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finalValue = formatDate(finalValue)
|
||||||
|
|
||||||
emit('update:modelValue', finalValue)
|
emit('update:modelValue', finalValue)
|
||||||
emit('change', finalValue)
|
emit('change', finalValue)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user