Javascript 使用Meteor页面实现分页时出错

Javascript 使用Meteor页面实现分页时出错,javascript,pagination,meteor,Javascript,Pagination,Meteor,我指的是流星页面的基本演示 基本演示 流星页 其思想是创建分页,并在每页显示1条建议 浏览器中未显示任何内容,我遇到以下错误: Uncaught TypeError: Cannot set property 'pagesData' of undefined Exception from Deps recompute function: Error: Expected null or template in return value from inclusion function,

我指的是流星页面的基本演示

基本演示

流星页

其思想是创建分页,并在每页显示1条建议

浏览器中未显示任何内容,我遇到以下错误:

Uncaught TypeError: Cannot set property 'pagesData' of undefined 

Exception from Deps recompute function: Error: Expected null or template in return value     
from inclusion function, found: [object Object]
我的代码是:

咖啡

@Pages = new Meteor.Pagination 'Recommendations',
  perPage: 1
建议:咖啡

@Recommendations = new Meteor.Collection("recommendations")
@Recommendations = new Meteor.Collection("recommendations")

// Pagination must put directly under the collections, because we want to run the 
// collection first before making the pagination

@Pages = new Meteor.Pagination Recommendations,
  perPage: 1    
建议列表.html

<template name="recommendationsList">
 <h1>Recommendations for each user</h1>
  <div>
   {{#each recommendations}}
    {{> recommendationItem}}
   {{/each}}
  </div>

  {{> recommendations}}
</template>

<template name="recommendations">
 {{> pagesNav}}
 {{> pages}}
</template>
<template name="recommendationsList">
 <h1>Recommendations for each user</h1>
  <div>
  {{> recommendations}}
  </div>
</template>

<template name="recommendations">
 {{> pagesNav}}
 {{> pages}}
</template>

对每个用户的建议
{{{每项建议}
{{>recommendationItem}
{{/每个}}
{{>建议}
{{>pagesNav}
{{>页面}

解决了,我在前面的代码中做了两件事。以下是修正案

建议:咖啡

@Recommendations = new Meteor.Collection("recommendations")
@Recommendations = new Meteor.Collection("recommendations")

// Pagination must put directly under the collections, because we want to run the 
// collection first before making the pagination

@Pages = new Meteor.Pagination Recommendations,
  perPage: 1    
建议列表.html

<template name="recommendationsList">
 <h1>Recommendations for each user</h1>
  <div>
   {{#each recommendations}}
    {{> recommendationItem}}
   {{/each}}
  </div>

  {{> recommendations}}
</template>

<template name="recommendations">
 {{> pagesNav}}
 {{> pages}}
</template>
<template name="recommendationsList">
 <h1>Recommendations for each user</h1>
  <div>
  {{> recommendations}}
  </div>
</template>

<template name="recommendations">
 {{> pagesNav}}
 {{> pages}}
</template>

对每个用户的建议
{{>建议}
{{>pagesNav}
{{>页面}