公式如果配置了自定义条件, didmount 也应该判断

This commit is contained in:
liaoxuezhi 2019-09-10 11:57:43 +08:00
parent 782a767943
commit c0de429521
1 changed files with 3 additions and 1 deletions

View File

@ -12,10 +12,12 @@ export interface FormulaProps extends FormControlProps {
export default class FormulaControl extends React.Component<FormControlProps, any> {
componentDidMount() {
const {formula, data, setPrinstineValue, initSet} = this.props;
const {formula, data, setPrinstineValue, initSet, condition} = this.props;
if (!formula || initSet === false) {
return;
} else if (condition && !~condition.indexOf('$') && !~condition.indexOf('<%') && !evalJS(condition, data as object)) {
return;
}
const result: any = evalJS(formula, data as object);