diff --git a/docs/demo/FR2/index.jsx b/docs/demo/FR2/index.jsx index aa4a547b3..5d0d3d2a5 100644 --- a/docs/demo/FR2/index.jsx +++ b/docs/demo/FR2/index.jsx @@ -7,7 +7,7 @@ import { Button } from 'antd'; const Demo = ({ schema = {} }) => { const [formData, setFormData] = useState(() => schema.formData); const [valid, setValid] = useState([]); - const [showValid, setShowValid] = useState(false); + const [showValid, setShowValid] = useState(true); // useEffect(() => { // setTimeout(() => setFormData({ crowd: { upfIdList: 'sdfsdf' } }), 1500); diff --git a/docs/demo/new-feature/test.json b/docs/demo/new-feature/test.json index f9a677b9d..1aae2cedc 100644 --- a/docs/demo/new-feature/test.json +++ b/docs/demo/new-feature/test.json @@ -10,6 +10,11 @@ "title": "测试效验", "type": "string", "ui:hidden": "{{formData.string!=='2'}}" + }, + "color": { + "title": "颜色选择", + "type": "string", + "format": "color" } }, "required": ["string22"] diff --git a/src/base/validate.js b/src/base/validate.js index 1904d0661..551e31ad1 100644 --- a/src/base/validate.js +++ b/src/base/validate.js @@ -88,8 +88,7 @@ export const getValidateText = (obj = {}) => { // TODO: 为了一个Color引入了一个挺大的包,可以优化 if (format === 'color' || widget === 'color') { try { - // if (!finalValue) return '请填写正确的颜色格式'; - Color(finalValue); + Color(finalValue || null); // 空字符串无法解析会报错,出现空的情况传 null } catch (e) { return '请填写正确的颜色格式'; }