HTML:
<polymer-element name="sp-button" attributes="active">
<template>
<link rel="stylesheet" href="sp-button.css">
<button type="button"><content></content></button>
</template>
<script src="sp-button.js"></script>
</polymer-element>
JS:
Polymer('sp-button', {
active: false,
activeChanged: function() {
console.log('active ' + this.active);
}
});
我不知道如何允许聚合物元件的用户收听点击事件或悬停事件。此外,在两个按钮被包裹在该聚合物元件中的情况下。你的元素的
你能举一个例子来说明怎么做?一个代码示例有助于做出很好的答案。 :) –
'button.addEventListener('receive',function(e){e.stopPagagation(); // ...});' –
或'onSendClick:function(e){e.stopPropagation(); this.fire( '发送'); }' –