mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 17:18:40 +08:00
parent
ebbe7e4079
commit
25649dbca5
@ -315,7 +315,7 @@ export function isArray(value: any): value is Array<any> {
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
export function isFunction<T extends Function>(value: any): value is T {
|
export function isFunction<T extends Function>(value: any): value is T {
|
||||||
return getType(value) === 'function'
|
return getType(value) === 'function' || getType(value) === 'asyncfunction'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -124,7 +124,7 @@ export type UploadMethod = (
|
|||||||
onError: (res: UniApp.GeneralCallbackResult, file: UploadFileItem, formData: UploadFormData) => void
|
onError: (res: UniApp.GeneralCallbackResult, file: UploadFileItem, formData: UploadFormData) => void
|
||||||
onProgress: (res: UniApp.OnProgressUpdateResult, file: UploadFileItem) => void
|
onProgress: (res: UniApp.OnProgressUpdateResult, file: UploadFileItem) => void
|
||||||
}
|
}
|
||||||
) => void
|
) => void | Promise<void>
|
||||||
|
|
||||||
export const uploadProps = {
|
export const uploadProps = {
|
||||||
...baseProps,
|
...baseProps,
|
||||||
|
|||||||
@ -178,7 +178,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.beforePreview,
|
() => props.beforePreview,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of beforePreview must be Function')
|
console.error('The type of beforePreview must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -191,7 +191,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.onPreviewFail,
|
() => props.onPreviewFail,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of onPreviewFail must be Function')
|
console.error('The type of onPreviewFail must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -204,7 +204,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.beforeRemove,
|
() => props.beforeRemove,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of beforeRemove must be Function')
|
console.error('The type of beforeRemove must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -217,7 +217,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.beforeUpload,
|
() => props.beforeUpload,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of beforeUpload must be Function')
|
console.error('The type of beforeUpload must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -230,7 +230,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.beforeChoose,
|
() => props.beforeChoose,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of beforeChoose must be Function')
|
console.error('The type of beforeChoose must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -243,7 +243,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.buildFormData,
|
() => props.buildFormData,
|
||||||
(fn) => {
|
(fn) => {
|
||||||
if (fn && !isFunction(fn) && getType(fn) !== 'asyncfunction') {
|
if (fn && !isFunction(fn)) {
|
||||||
console.error('The type of buildFormData must be Function')
|
console.error('The type of buildFormData must be Function')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user