bugfix: 修复H5日期组件返回的值缺少秒的问题

This commit is contained in:
niedongsheng 2026-04-10 13:56:27 +08:00
parent 80909dfd4d
commit 2d3253ba0e

View File

@ -55,6 +55,7 @@
<script setup>
import { ref, computed, watch } from 'vue'
import { Field, Popup, DatePicker, TimePicker } from 'vant'
import { formatDate } from '@shared/utils'
// Props
const props = defineProps({
@ -141,6 +142,11 @@ const props = defineProps({
return option
}
},
//
resultFormat: {
type: String,
default: 'YYYY-MM-DD HH:mm:ss'
},
//
filter: {
type: Function,
@ -350,7 +356,6 @@ const formatTimePart = () => {
//
const onConfirm = () => {
let finalValue = formatDatePart()
if (hasTime.value) {
const timePart = formatTimePart()
if (timePart) {
@ -358,6 +363,8 @@ const onConfirm = () => {
}
}
finalValue = formatDate(finalValue)
emit('update:modelValue', finalValue)
emit('change', finalValue)
showPicker.value = false