Polymer 聚合物dom重复过滤器未捕获类型错误
在执行我的代码(使用dom repeat、filter和observe)时,我得到以下错误:Polymer 聚合物dom重复过滤器未捕获类型错误,polymer,polymer-1.0,Polymer,Polymer 1.0,在执行我的代码(使用dom repeat、filter和observe)时,我得到以下错误: Uncaught TypeError: Cannot read property 'apply' of undefined VM8037 polymer-mini.html:2057 _filterFn @ VM8038 polymer.html:4147 (anonymous function) @ VM8038 polymer.html:4282 Polymer._apply
Uncaught TypeError: Cannot read property 'apply' of undefined VM8037 polymer-mini.html:2057
_filterFn @ VM8038 polymer.html:4147
(anonymous function) @ VM8038 polymer.html:4282
Polymer._applyFullRefresh @ VM8038 polymer.html:4281
Polymer._render @ VM8038 polymer.html:4231
Debouncer.complete @ VM8037 polymer-mini.html:2095
boundComplete @ VM8037 polymer-mini.html:2074
Polymer.Async._atEndOfMicrotask @ VM8037 polymer-mini.html:2051
window.MutationObserver.observe.characterData @ VM8037 polymer-mini.html:2066
如果我从
中删除属性“filter”和“observe”,则“dom repeat”可以正常工作,否则“dom repeat”将失败,并且菜单项不会呈现
index.html代码:
...
<template is="dom-bind" id="app">
...
<template id="tmenu" is="dom-repeat" items="{{content.sections}}"
filter="dataFilters.showUnpublished" observe="item.published">
<paper-button raised class="top-nav">
<a data-route="{{item.route}}" href="{{baseUrl}}{{item.route}}">
<span>{{item.menu}}</span>
</a>
</paper-button>
</template>
</template>
...
...
app.dataFilters = {
// called by the templates that "renders" the top and the drawer menus.
showUnpublished: function(item) {
console.log(item);
if (app.sysVars.granted && app.sysVars.signedIn) {
console.log(true);
return true;
}
console.log(false);
return item.published; //item.published is a boolean
}
};
app.content = { project: {}, sections: [] };
window.addEventListener('gapiLoaded', function() {
...
// prior code retrieves the content from the server
// and injects it using the following 2 lines:
app.set('content.sections', resp.sections);
app.set('content.project', resp.project);
...
)};
...
该错误是否表示存在聚合物缺陷
我做错什么了吗
干杯您是否尝试了
observe=“published”
而不是observe=“item.published”
?我找到了问题的根源。我将尽快发布我发现的内容。:)@山姆,你找到解决办法了吗?