【发布时间】:2013-07-07 16:43:15
【问题描述】:
我正在寻找一种从 DOM 访问 Polymer 自定义元素的属性的方法 或将数据从 Polymer.register 发送到 DOM。
下面这个非常简单的元素接受两个值并将它们相乘,将结果放在其result 属性中。
如何从外部访问此结果?
<element attributes='value times result' name='value-box'>
<template>
<p>{{result}}</p>
</template>
<script>
Polymer.register(this, {
ready: function() {
if (this.value != null && this.times != null) {
this.result = this.value * this.times;
}
}
});
</script>
</element>
【问题讨论】:
标签: polymer shadow-dom