fix: 修复 JSFunction 表达式使用时,无法去掉 this 使用 scope 变量

This commit is contained in:
liujuping 2022-03-07 23:24:23 +08:00
parent de5d0650df
commit 38389cf5b8
2 changed files with 2 additions and 2 deletions

View File

@ -712,7 +712,7 @@ export default function baseRenererFactory() {
) {
return checkProps(props);
}
if (isJSExpression(props)) {
if (isJSExpression(props) || isJSFunction(props)) {
props = parseExpression(props, scope);
// 只有当变量解析出来为模型结构的时候才会继续解析
if (!isSchema(props) && !isJSSlot(props)) return checkProps(props);

View File

@ -412,7 +412,7 @@ export function parseData(schema: any, self: any): any {
return schema;
}
/* 全匹配{{开头,}}结尾的变量表达式或者对象类型JSExpression支持省略this */
/* 全匹配{{开头,}}结尾的变量表达式或者对象类型JSExpression/JSFunction支持省略this */
export function parseExpression(str: any, self: any) {
try {
const contextArr = ['"use strict";', 'var __self = arguments[0];'];