Apache Royale 中的 id 和 localId 有什么区别? [英] What's the difference between id and localId in Apache Royale?
问题描述
在 Apache Royale 中,我们可以使用id
"和localId
"属性来识别对象.问题是要知道为什么我们显然有两种方法可以做同样的事情.
In Apache Royale we can identify objects with "id
" and "localId
" properties. The problem is to know why we have two ways of doing the same apparently.
推荐答案
我找到了答案并分享解决方案:
I found the Answer and sharing solution:
HTML 需要唯一的 ID,因此通过创建内部使用 ID 来标识内部子组件的 Royale 组件,这意味着将在创建的所有实例中使用相同的 ID,因此会产生缺乏唯一性的问题.
HTML requires ID's that are unique, so by creating Royale components that internally use ID's to identify the inner sub-components this means the same ID will be used in all instances created and therefore generating a problem of lack of uniqueness.
解决方案:
在内部组件中使用localId
",所以Royale 将在内部使用它,并避免在转换为HTML 时添加id
".
Solution:
Use "localId
" in the inner components, so Royale will use it internally and will avoid to add "id
" when you transpile to HTML.
这篇关于Apache Royale 中的 id 和 localId 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!