polymer을 사용하여 버튼을 감 쌉니다.폴리머로 이벤트 라우팅하기
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.stopPropagation(); // ...}), ' –
'또는 'onSendClick : function (e) {e.stopPropagation(); this.fire ('send'); }' –