mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-03 07:47:18 +00:00
fix: 🐛 经验证发现小程序里面还是得包上 eval 否则 Rax 框架会误把 context 发送到渲染进程而出错
This commit is contained in:
parent
8d198bd2a9
commit
c7a10c035c
@ -194,14 +194,6 @@ function transformJsExpr(expr: string, handlers: CustomHandlerSet) {
|
|||||||
case 'FunctionExpression':
|
case 'FunctionExpression':
|
||||||
return transformThis2Context(exprAst, handlers);
|
return transformThis2Context(exprAst, handlers);
|
||||||
|
|
||||||
// 对于直接访问 this.xxx, this.utils.xxx, this.state.xxx 的也不用再包下
|
|
||||||
case 'MemberExpression':
|
|
||||||
if (isSimpleDirectlyAccessingThis(exprAst) || isSimpleDirectlyAccessingSafeProperties(exprAst)) {
|
|
||||||
return transformThis2Context(exprAst, handlers);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,13 +83,13 @@ class Home$$Page extends Component {
|
|||||||
<View>
|
<View>
|
||||||
<Text>=== User Info: ===</Text>
|
<Text>=== User Info: ===</Text>
|
||||||
</View>
|
</View>
|
||||||
{__$$context.state.user && (
|
{__$$eval(() => __$$context.state.user) && (
|
||||||
<View style={{ flexDirection: 'row' }}>
|
<View style={{ flexDirection: 'row' }}>
|
||||||
<Image
|
<Image
|
||||||
source={{ uri: __$$eval(() => __$$context.state.user.avatar) }}
|
source={{ uri: __$$eval(() => __$$context.state.user.avatar) }}
|
||||||
style={{ width: '32px', height: '32px' }}
|
style={{ width: '32px', height: '32px' }}
|
||||||
/>
|
/>
|
||||||
<View onClick={__$$context.hello}>
|
<View onClick={__$$eval(() => __$$context.hello)}>
|
||||||
<Text>{__$$eval(() => __$$context.state.user.name)}</Text>
|
<Text>{__$$eval(() => __$$context.state.user.name)}</Text>
|
||||||
<Text>{__$$eval(() => __$$context.state.user.age)}岁</Text>
|
<Text>{__$$eval(() => __$$context.state.user.age)}岁</Text>
|
||||||
</View>
|
</View>
|
||||||
@ -132,7 +132,7 @@ class Home$$Page extends Component {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>点击次数:{__$$context.state.clickCount}(点击加 1)</Text>
|
<Text>点击次数:{__$$eval(() => __$$context.state.clickCount)}(点击加 1)</Text>
|
||||||
</View>
|
</View>
|
||||||
<View>
|
<View>
|
||||||
<Text>操作提示:</Text>
|
<Text>操作提示:</Text>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Home$$Page extends Component {
|
|||||||
__$$context.setLocale(__$$context.getLocale() === 'en-US' ? 'zh-CN' : 'en-US');
|
__$$context.setLocale(__$$context.getLocale() === 'en-US' ? 'zh-CN' : 'en-US');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{__$$context.i18n['hello-world']}
|
{__$$eval(() => __$$context.i18n['hello-world'])}
|
||||||
</Text>
|
</Text>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user