lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

ReactRenderer的appHelper,能否自定义方法或者变量到上下文this

Open bruceweasley88 opened this issue 2 years ago • 11 comments

Describe the bug (required) / 详细描述 bug(必填)

ReactRenderer的appHelper,能否自定义方法或者变量到上下文this


Screenshots (optional) / 截图(可选)

image image


bruceweasley88 avatar Mar 13 '23 09:03 bruceweasley88

你直接试试咯

JackLian avatar Mar 13 '23 09:03 JackLian

你直接试试咯

就是好像是不支持的,现在有什么方法实现吗?

bruceweasley88 avatar Mar 13 '23 09:03 bruceweasley88

@JackLian 就是好像是不支持的,现在有什么方法实现吗?

bruceweasley88 avatar Mar 13 '23 09:03 bruceweasley88

@liujuping 请问有什么方法实现吗?

bruceweasley88 avatar Mar 13 '23 09:03 bruceweasley88

变量在协议的state字段定义,通过this.state获取,appHelper定义的在this.utils字段,不是吗?

LeoYuan avatar Mar 13 '23 10:03 LeoYuan

@LeoYuan 对啊,但是想实现this.xxx。现在在appHelper实现的是this.utils.xxx,隔了一层utils

bruceweasley88 avatar Mar 14 '23 02:03 bruceweasley88

那就挂到schema中的methods字段

LeoYuan avatar Mar 14 '23 02:03 LeoYuan

那就挂到schema中的methods字段

那就是,目前没办法实现这个功能了。(挂methods,js面板一改又会重新生成methods)

bruceweasley88 avatar Mar 14 '23 02:03 bruceweasley88

image

小试了一下,貌似可以~(非权威解答,热心群众贡献)

LeoYuan avatar Mar 14 '23 02:03 LeoYuan

image

小试了一下,貌似可以~(非权威解答,热心群众贡献)

image image

bruceweasley88 avatar Mar 14 '23 02:03 bruceweasley88

那就是这个面板不支持从协议中读取新的变更,面板回写也是直接覆盖原协议内容,建议fork该面板插件自己改

LeoYuan avatar Mar 14 '23 02:03 LeoYuan