fix: 修复日期选择器显示NaN问题
- detail.vue: 修正onDateChange方法,使用e.detail.value获取日期值 - 原生picker返回的是日期字符串,无需Date解析
This commit is contained in:
parent
8584640282
commit
838ce7fb1d
@ -580,12 +580,9 @@ const resetTransactionForm = () => {
|
||||
};
|
||||
|
||||
const onDateChange = (e) => {
|
||||
const date = new Date(e.value);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
transactionForm.value.transactionDate = `${year}-${month}-${day}`;
|
||||
transactionForm.value.dateTimestamp = e.value;
|
||||
// 原生 picker 直接返回日期字符串 YYYY-MM-DD
|
||||
transactionForm.value.transactionDate = e.detail.value;
|
||||
transactionForm.value.dateTimestamp = new Date(e.detail.value).getTime();
|
||||
};
|
||||
|
||||
const submitTransaction = async () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user