在 dart 中,我必须使自定义元素与 main() 函数进行通信。正如 Dart-polymer-example ( https://github.com/sethladd/dart-polymer-dart-examples/blob/master/web/custom_element_with_custom_attribute_binding/index.html ) 中的示例所指出的,目前绑定(bind)不起作用。
<template id="tmpl" bind>
<my-element value="{{value}}" id="test"></my-element>
<!-- This should be updating, but it's not updating -->
<!-- See http://code.google.com/p/dart/issues/detail?id=12440 -->
<p>The model's value is {{value}}</p>
</template>
我尝试了几种替代方式,例如“query(”#test”).attributes[“value”]”,它们不起作用。还有其他方法可以尝试吗?
谢谢!
最佳答案
是的,我有一个非常相似的问题!您可以查询 DOM,然后获取 xtag 属性来获取底层 Polymer 对象。所以这个例子是:
query("#test").xtag.value
有关更多详细信息,请参阅文档:
https://www.dartlang.org/articles/web-ui/spec.html#retrieval
关于dart - 在 Dart 中,是否有任何替代方法可用于 <polymer-element> 和 main() 之间的通信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18948560/