mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-01 13:40:41 +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':
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -83,13 +83,13 @@ class Home$$Page extends Component {
|
||||
<View>
|
||||
<Text>=== User Info: ===</Text>
|
||||
</View>
|
||||
{__$$context.state.user && (
|
||||
{__$$eval(() => __$$context.state.user) && (
|
||||
<View style={{ flexDirection: 'row' }}>
|
||||
<Image
|
||||
source={{ uri: __$$eval(() => __$$context.state.user.avatar) }}
|
||||
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.age)}岁</Text>
|
||||
</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>
|
||||
<Text>操作提示:</Text>
|
||||
|
||||
@ -47,7 +47,7 @@ class Home$$Page extends Component {
|
||||
__$$context.setLocale(__$$context.getLocale() === 'en-US' ? 'zh-CN' : 'en-US');
|
||||
}}
|
||||
>
|
||||
{__$$context.i18n['hello-world']}
|
||||
{__$$eval(() => __$$context.i18n['hello-world'])}
|
||||
</Text>
|
||||
</Page>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user