1
我使用聚合物1.0,並在註冊方法和調用方法時遇到問題。它在Chrome中運行良好,但在Firefox中我收到以下錯誤消息:dom-bind錯誤:偵聽器方法未定義
[dom-bind::_createEventHandler]: listener method `_onCircleClick` not defined
以下代碼部分包含在其他聚合物元素內。
<template id="main" is="dom-bind">
<neon-animated-pages id="pages" selected="0">
<main-page on-circle-click="_onCircleClick"></main-page>
<detail-page on-click="_onPageClick"></detail-page>
</neon-animated-pages>
</template>
<script>
var template = document.querySelector('#main');
template._onCircleClick = function (event) {
this.$.pages.selected = 1;
};
template._onPageClick = function (event) {
this.$.pages.selected = 0;
};
</script>
我不知道爲什麼它不起作用的Firefox。有任何想法嗎?
你加載webcomponents.js填充工具的? –
是的,我正在加載'' 但它沒有幫助 – Christian
附註:docs建議使用'on-tap'比'on-click':https://www.polymer-project.org/1.0/docs/devguide/events.html#gestures –