【问题标题】:Meteor Kurourin Pagination not working流星Kurourin分页不起作用
【发布时间】:2017-12-13 08:43:01
【问题描述】:

我在meteorJS框架中使用Kurourin分页包,但它不工作。它只在我的 blaze html 文件中返回一个错误。它也只在我的 html 文件中显示加载。我只是新手,所以请理解。

根据大气中的文档,代码如下

//Error 
Error: No such template: defaultBootstrapPaginator
at blaze.js:3212
at Blaze.View.<anonymous> (spacebars.js:68)
at blaze.js:1934
at Function.Template._withTemplateInstanceFunc (blaze.js:3744)
at blaze.js:1932
at Object.Blaze._withCurrentView (blaze.js:2271)
at viewAutorun (blaze.js:1931)
at Tracker.Computation._compute (tracker.js:339)
at new Tracker.Computation (tracker.js:229)
at Object.Tracker.autorun (tracker.js:613)

//blaze html file 
<div class="row">
{{#if isReady}}
        <ul class="list-group">
          {{#each platforms}}
              <li class="list-group-item">{{platform}}</li>
          {{/each}}
        </ul>
        {{> defaultBootstrapPaginator pagination=templatePagination limit=10 containerClass="text-center" onClick=clickEvent}}
{{/if}}
</div>


//create_hardwarepl.js file
Template.create_hardwarepl.onCreated(function () {
this.pagination = new Meteor.Pagination(Platforms, {
    sort: {
        _id: -1
    }
});
});

Template.create_hardwarepl.helpers({
 platforms: function()
 {
   return Platforms.find({},{sort: {createdAt: -1}});
 },
 isReady: function () 
 {
   return Template.instance().pagination.ready();
 },
 templatePagination: function () 
 {
    return Template.instance().pagination;
 },
 documents: function () 
 {
    return Template.instance().pagination.getPage();
 },
 // optional helper used to return a callback that should be executed before 
    changing the page
 clickEvent: function() 
 {
   return function(e, templateInstance, clickedPage) 
   {
      e.preventDefault();
      console.log('Changing page from ', 
      templateInstance.data.pagination.currentPage(), ' to ', clickedPage);
   };
 }
 });

//server/publications.js file

import { publishPagination } from 'meteor/kurounin:pagination';

publishPagination(Platforms);

【问题讨论】:

    标签: javascript meteor pagination nosql meteor-blaze


    【解决方案1】:

    我遇到了同样的问题,然后我检查了 kurourin GitHub 存储库,还有另一个基于订阅的分页。单击此link

    以上链接对你有帮助

    【讨论】:

      【解决方案2】:

      添加流星包kurounin:pagination-blazemeteor add kurounin:pagination-blaze

      https://atmospherejs.com/i/installing

      【讨论】:

        猜你喜欢
        • 2015-11-18
        • 2014-07-15
        • 2017-05-25
        • 1970-01-01
        • 2015-04-06
        • 2013-03-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多