fix: #3330 异步加载字典导致偶尔出现字典未翻译的问题修复,改为async/await等待加载完成后,才继续执行后续代码 #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复偶尔出现的字典未翻译的问题
原来的watch方法中,存在调用接口来获取数据,是异步操作,如果接口响应较慢,就会出现字典未翻译的情况。
将上述代码改为async/await方式,等待接口返回数据之后再进行后续操作。
由于watch改为了async函数,会导致 "子表默认新增空数据" 功能异常
具体表现为,列数据还未加载成功时,就执行了 "子表默认新增空数据" 操作。会报错,自动产生的列序号、字段默认值等信息无法自动填充。
因此,新增了一个flag字段,用来表示该组件已加载完成,可以进行后续操作了。
getRefPromise获取ref时,会等待组件加载完成后,才进行后续操作。