根据我的说法,尽管一切都是正确的,我的加载更多按钮仍未显示

时间:2022-12-05 18:49:59

HTML side code

HTML端代码

<template name="profPageAuthorSubmit">
    <div>
        <ul style="list-style-type:none" class="pclProf">
            <li><img id="profilePagePic" src="{{profilePagePicture}}"><span class="username">{{authorSubmit}}</span></li>
            <li class="accesories">{{a}} Poems</li>
            <li class="accesories">{{b}} Short stories</li>
            <li class="accesories">{{c}} Followers</li>
            <li class="accesories">{{d}} Followings</li>
        </ul>
    </div>
    <div>
    <ul style="list-style-type:none" class="pcl">
    {{#each Contents}}
      <li class="p">
        <p class="bucket">  
          <li><span class="contentType">{{type}}</span></li>
          <li><span class="titleBody"><strong>{{{title}}}</strong></span></li>
          <li><a href="/user/{{createdBy}}"><img class="authorPic" src="{{authorPhoto}}"><span class="authorName">{{author}}</span></a></li>
          <li><span class="createdAtTime">Written at {{createdAt}}</span></li>  
          <li class="contentMain">{{{content}}}</li>
          {{>contentEssentials}}
          {{#if editing}}
            {{>contentEdit}}
          {{/if}}
          {{>commentsTemp}}
        </p>
      </li>
    {{/each}}
    **{{#if nextPath}}
        <a href="{{nextPath}}" class="btn btn-default load-more">Load more</a>
          {{#unless ready}}
            {{> spinner}}
          {{/unless}}
    {{/if}}**
    </ul>
    </div>
</template>

Client side code

客户端代码

profileController= RouteController.extend({
  template: 'profPageAuthorSubmit',
  increment: 10,
  contentsLimit: function() {
    return parseInt(this.params.contentsLimit) || this.increment;
  },
  findOptions: function() {
    return {sort: {createdAt: -1}, limit: this.contentsLimit()};
  },
  subscriptions: function() {
    this.ContentsSub = Meteor.subscribe('contents', this.findOptions());
    return Meteor.subscribe('allUserData');
  },
  Contents: function() {
    var locationArray= location.href.split('/');
    var UserId= locationArray[4];
    return contentsList.find({createdBy: UserId, anonymous: false}, this.findOptions());
  },
  data: function() {
    var hasMore = this.Contents().count() === this.contentsLimit();
    var nextPath = this.route.path({contentsLimit: this.contentsLimit() + this.increment});
    console.log("ready");
    return {
      Contents: this.Contents(),
      ready: this.ContentsSub.ready,
      nextPath: hasMore ? nextPath : null
    };
}
});

Router.map(function(){
  Router.route('profPageAuthorSubmit',{
    path: '/user/:createdBy/:contentsLimit?',
    controller: profileController
  });
});

Why is load-more button not showing. I have checked it again and again but still it is not showing. The same thing has worked in other templates. Basically it is checking whether the contents number is greater than the number displayed, if it is then the load more button should show. Thanking all

为什么load-more按钮没有显示。我一次又一次地检查了它但仍然没有显示出来。同样的事情在其他模板中也有效。基本上它是检查内容编号是否大于显示的数字,如果是,那么加载更多按钮应该显示。感谢所有人

1 个解决方案

#1


0  

As far as i know, every child of a "ul" tag must be a "li" tag. So the "a" isnt recognized. Try to put the content inside a "li" tag.

据我所知,每个“ul”标签的孩子都必须是“li”标签。所以“a”不被认可。尝试将内容放在“li”标记内。

#1


0  

As far as i know, every child of a "ul" tag must be a "li" tag. So the "a" isnt recognized. Try to put the content inside a "li" tag.

据我所知,每个“ul”标签的孩子都必须是“li”标签。所以“a”不被认可。尝试将内容放在“li”标记内。