mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(utils): 修复isNull和IsNotNull判断方法潜在问题
This commit is contained in:
@ -2,6 +2,7 @@ import { ref, toValue } from 'vue';
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import type { FormInst } from 'naive-ui';
|
||||
import { REG_CODE_SIX, REG_EMAIL, REG_PHONE, REG_PWD, REG_USER_NAME } from '@/constants/reg';
|
||||
import { isNull } from '@/utils/common';
|
||||
import { $t } from '@/locales';
|
||||
|
||||
export function useFormRules() {
|
||||
@ -52,7 +53,7 @@ export function useFormRules() {
|
||||
required: true,
|
||||
trigger: ['input', 'blur'],
|
||||
validator: (_rule: any, value: any) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
if (isNull(value) || (Array.isArray(value) && value.length === 0)) {
|
||||
return new Error(message);
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user