mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 17:31:18 +08:00
fix(amis-saas-7103): 完善开关组件默认值类型校验
Change-Id: I08a1eabf77fbc783ec328fab2387ccaddca7bfbc
This commit is contained in:
parent
2b83ed3913
commit
74530d9ef1
@ -219,6 +219,7 @@ export default class FormulaControl extends React.Component<
|
|||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined) {
|
||||||
return true; // 数值为空不进行类型识别
|
return true; // 数值为空不进行类型识别
|
||||||
}
|
}
|
||||||
|
const {rendererSchema} = this.props;
|
||||||
const expectType = this.props.valueType;
|
const expectType = this.props.valueType;
|
||||||
|
|
||||||
if (expectType === null || expectType === undefined) {
|
if (expectType === null || expectType === undefined) {
|
||||||
@ -228,7 +229,10 @@ export default class FormulaControl extends React.Component<
|
|||||||
// 当前数据域
|
// 当前数据域
|
||||||
const curData = this.getContextData();
|
const curData = this.getContextData();
|
||||||
|
|
||||||
if (
|
if (rendererSchema.type === 'switch' && (rendererSchema.trueValue !== undefined || rendererSchema.falseValue !== undefined)) {
|
||||||
|
// 开关类型组件单独处理
|
||||||
|
return rendererSchema.trueValue === value || rendererSchema.falseValue === value;
|
||||||
|
} else if (
|
||||||
(expectType === 'number' && isNumber(value)) ||
|
(expectType === 'number' && isNumber(value)) ||
|
||||||
(expectType === 'boolean' && isBoolean(value)) ||
|
(expectType === 'boolean' && isBoolean(value)) ||
|
||||||
(expectType === 'object' && isPlainObject(value)) ||
|
(expectType === 'object' && isPlainObject(value)) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user