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

如何在面板切换资产包版本?

Open WisestCoder opened this issue 3 years ago • 8 comments

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

image

给搭建器加了资产包版本管理的功能,切换版本后,调用material.setAssest(newVersionAssest)却无法更新组件库的内容;在控制台打印window.AliLowCodeEngine.material.componentsMap还是初始化的组件列表,打印window.MyComponentMeta也是初始化组件列表 image

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述


To Reproduce (required) / 如何复现 bug?(必填,非常重要)

按照bug描述的步骤即可复现

Expected behavior (required) / 预期行为(必填,非常重要)

预期material.setAssets(x)能够有效替换资产包,或者提供一个新的方法达到所需功能

Environments (please complete the following information) (required): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 1.0.7
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 1.0.3
  • Browser [e.g. chrome, safari] / chrome latest
  • materials / plugins / tools / 自定义物料

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

WisestCoder avatar Aug 08 '22 03:08 WisestCoder

麻烦参考这个文档提供必要信息、demo、源码等 https://www.yuque.com/lce/doc/yvlxhs

JackLian avatar Aug 08 '22 04:08 JackLian

你好 @WisestCoder,由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 issue bug 模板 补全信息,也可以通过阅读引擎的 issue 说明 了解什么类型的 issue 可以获得更好、更快的支持。

github-actions[bot] avatar Aug 08 '22 04:08 github-actions[bot]

@JackLian 简单来说,希望material能增加一个方法类似material.changeAssets去更新资产包;目前material.setAssets只会在第一次调用才会生效

WisestCoder avatar Aug 08 '22 07:08 WisestCoder

你在你本地的 engine-core.ts 里加一行试试~

image

LeoYuan avatar Aug 08 '22 09:08 LeoYuan

@LeoYuan 不行,光是refresh没用,你没把老的清空;_componentMetasMap的值还是夹带老的

WisestCoder avatar Aug 08 '22 09:08 WisestCoder

手动把_componentMetasMap值重置后再设置,值是对的,但是面板没更新

image

image

image

WisestCoder avatar Aug 08 '22 09:08 WisestCoder

可以确认下组件面板用的是哪个字段来获取所有组件,然后再针对性的改一下~

LeoYuan avatar Aug 08 '22 11:08 LeoYuan

@LeoYuan 刚debug了一下代码;组件面板就是获取上下文中的assets。面板在componentDidMount里取监听了assets的变化,代码如下: image

但奇怪的是,回调函数(传入的initComponentList)被立即执行了,而并不是把回调塞入等待队列中,代码如下: image

由于未塞入到等待队列中,后续事件触发的时候,并没有执行initComponentList;能否抽空看下这一块的设计,看起来时候问题的。

WisestCoder avatar Aug 09 '22 06:08 WisestCoder

@WisestCoder 我也遇到你类似的问题,请问你怎么解决的吗?

luoxq1212 avatar Apr 10 '23 08:04 luoxq1212

@WisestCoder 我也遇到你类似的问题,请问你怎么解决的吗?

解决不了,代码的bug,我后面是切换版本后直接把页面load了

WisestCoder avatar May 08 '23 10:05 WisestCoder

@WisestCoder 意思重启低码应用?

ranyue avatar Aug 09 '23 07:08 ranyue