fix(amis-core): autovar逻辑优化,执行resolveVariableAndFilter前先判断是否为表达式,减少性能损耗

This commit is contained in:
wibetter 2024-04-02 12:23:00 +08:00
parent b68842baf4
commit e6f2b6866d

View File

@ -23,6 +23,7 @@ import {isAlive} from 'mobx-state-tree';
import {reaction} from 'mobx';
import {resolveVariableAndFilter} from './utils/tpl-builtin';
import {buildStyle} from './utils/style';
import {isExpression} from './utils/formula';
import {StatusScopedProps} from './StatusScoped';
import {evalExpression, filter} from './utils/tpl';
@ -491,7 +492,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
if (renderer.autoVar) {
for (const key of Object.keys(schema)) {
if (typeof props[key] === 'string') {
if (typeof props[key] === 'string' && isExpression(props[key])) {
props[key] = resolveVariableAndFilter(
props[key],
props.data,