代碼就像下面的工作正常Chrome,但在Firefox我使用聚合物時,遇到下列錯誤1.9.1DOM,如果在Firefox不能使用的功能「如果」價值
[未定義:: _annotatedComputationEffect]:計算方法hasMoreData
沒有定義
<template>
<template is="dom-repeat" items="[[sections]]">
<div>
<template is="dom-if" if="{{hasMoreData(item)}}">
<div name="loadMore">load more</div>
</template>
</div>
</template>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'listing-collection',
//...other stuff...
hasMoreData: function(item) {
return true;
}
});
});
</script>
這是很無奈的是一些基本的東西似乎不工作的文件說,在一個特定的新版瀏覽器,而在另一個正常工作的方式。像這樣的東西:(讓我擔心在生產中使用的聚合物。我面臨其他跨瀏覽器的問題,但他們身邊工作,但這次我覺得框架終於把我推在邊緣:)
您使用兩個範圍,所以你不能得到這個功能。嘗試發送它像一個道具從重複模板,如項目 – Dmitry
謝謝你的答覆。你能告訴我一個例子代碼中的「你的意思是把它像道具一樣從重複的模板中像道具一樣發送出去」嗎? – lee
我很抱歉,這是我的錯誤。我檢查了你的方法,如果我們沒有使用'HTMLImports.whenReady'回調就可以正常工作,因爲它在'webcomponents'準備好之前就被觸發了。 [瞭解更多關於它(http://stackoverflow.com/questions/37017594/what-is-the-difference-between-htmlimports-whenready-and-window-addeventliste) – Dmitry