Skip to content

Commit 59919b8

Browse files
committed
修复表格查询组件数字框无默认值默认0的问题
1 parent 2498cb7 commit 59919b8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎ui/zhontai.ui.admin.vue3/src/components/my-search/index.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const formRef = useTemplateRef<FormInstance>('formRef')
124124
// 表单初始值
125125
const formState = reactive<EmptyObjectType>(
126126
props.searchItems.reduce((acc: EmptyObjectType, item) => {
127-
acc[item.field] = item.defaultValue ?? ''
127+
acc[item.field] = item.defaultValue ?? null
128128
return acc
129129
}, {})
130130
)
@@ -174,7 +174,7 @@ const onSearch = async () => {
174174
const onReset = () => {
175175
formRef.value?.resetFields()
176176
props.searchItems.forEach((item) => {
177-
formState[item.field] = item.defaultValue ?? ''
177+
formState[item.field] = item.defaultValue ?? null
178178
})
179179
if (props.isResetSearch) onSearch()
180180
}

0 commit comments

Comments
 (0)