perf: If args of setFieldsValue is empty, it will not be executed

pull/38/head
xingyu 2023-10-30 17:47:57 +08:00
parent 29ef568c5f
commit 17f3b4cf40
2 changed files with 8 additions and 16 deletions

View File

@ -7,6 +7,7 @@ import type { UploadFile } from 'ant-design-vue/lib/upload/interface'
import { join } from 'lodash-es'
import { PlusOutlined } from '@ant-design/icons-vue'
import { useI18n } from '@/hooks/web/useI18n'
import { propTypes } from '@/utils/propTypes'
import { buildShortUUID } from '@/utils/uuid'
import { getAccessToken, getTenantId } from '@/utils/auth'
import { isArray, isNotEmpty, isUrl } from '@/utils/is'
@ -32,25 +33,13 @@ const props = defineProps({
type: Array,
default: () => ['image/png', 'image/jpeg'],
},
multiple: {
type: Boolean,
default: () => false,
},
multiple: propTypes.bool.def(false),
//
maxCount: {
type: Number,
default: () => 1,
},
maxCount: propTypes.number.def(1),
//
minCount: {
type: Number,
default: () => 0,
},
minCount: propTypes.number.def(0),
// MB
maxSize: {
type: Number,
default: () => 2,
},
maxSize: propTypes.number.def(5),
})
const emit = defineEmits(['change', 'update:value'])

View File

@ -113,6 +113,9 @@ export function useFormEvents({
* @description: Set form value
*/
async function setFieldsValue(values: Recordable): Promise<void> {
if (Object.keys(values).length === 0)
return
const fields = getAllFields()
// key 支持 a.b.c 的嵌套写法