mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
fix(amis-core): autovar逻辑优化,执行resolveVariableAndFilter前先判断是否为表达式,减少性能损耗
This commit is contained in:
parent
b68842baf4
commit
e6f2b6866d
@ -23,6 +23,7 @@ import {isAlive} from 'mobx-state-tree';
|
|||||||
import {reaction} from 'mobx';
|
import {reaction} from 'mobx';
|
||||||
import {resolveVariableAndFilter} from './utils/tpl-builtin';
|
import {resolveVariableAndFilter} from './utils/tpl-builtin';
|
||||||
import {buildStyle} from './utils/style';
|
import {buildStyle} from './utils/style';
|
||||||
|
import {isExpression} from './utils/formula';
|
||||||
import {StatusScopedProps} from './StatusScoped';
|
import {StatusScopedProps} from './StatusScoped';
|
||||||
import {evalExpression, filter} from './utils/tpl';
|
import {evalExpression, filter} from './utils/tpl';
|
||||||
|
|
||||||
@ -491,7 +492,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|||||||
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
||||||
if (renderer.autoVar) {
|
if (renderer.autoVar) {
|
||||||
for (const key of Object.keys(schema)) {
|
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] = resolveVariableAndFilter(
|
||||||
props[key],
|
props[key],
|
||||||
props.data,
|
props.data,
|
||||||
|
Loading…
Reference in New Issue
Block a user