Skip to content

Commit 4912f6c

Browse files
fix: 修复useValidator报错
1 parent 13c9300 commit 4912f6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hooks/web/useValidator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const useValidator = () => {
3030
const notSpace = (message?: string): FormItemRule => {
3131
return {
3232
validator: (_, val, callback) => {
33-
if (val.indexOf(' ') !== -1) {
33+
if (val?.indexOf(' ') !== -1) {
3434
callback(new Error(message || t('common.notSpace')))
3535
} else {
3636
callback()

0 commit comments

Comments
 (0)