【问题标题】:Gridsome Pager is not working inside componentGridsome Pager 在组件内部不起作用
【发布时间】:2020-04-12 12:35:26
【问题描述】:

如果我在索引内部使用 Pager 可以正常工作,但是当我在组件内部使用它时,我得到的却是不工作。有什么帮助吗?

<Pager :info="$static.posts.pageInfo" />

和 GraphQl

<static-query>
query Posts($page:Int){
  posts: allPost(perPage: 3, page: $page) @paginate{
    totalCount
    pageInfo {
      totalPages
      currentPage
      isFirst
      isLast
    }
    edges {
      node {
        title
        image
        id
        path
        excerpt
      }
    }
  }
}
</static-query>

【问题讨论】:

  • 您是否已将Pager 导入到您的组件中? import { Pager } from 'gridsome',或全局
  • “如果我在索引内部使用 Pager 正在工作” - 你的意思是在 index.vue 内部吗?
  • 我在分类上用过一次,效果很好
  • 但在组件中没有!
  • @Aliihane,我不确定我明白你在说什么......你所说的“在索引内”是什么意思?

标签: vue.js pagination pager gridsome


【解决方案1】:
<static-query>
query Posts($page:Int){
  posts: allPost(perPage: 3, page: $page) @paginate{
    totalCount
    pageInfo {
      totalPages
      currentPage
      isFirst
      isLast
    }
    edges {
      node {
        title
        image
        id
        path
        excerpt
      }
    }
  }
}
</static-query>

【讨论】:

    猜你喜欢
    • 2020-03-30
    • 2017-03-12
    • 2020-03-10
    • 1970-01-01
    • 1970-01-01
    • 2019-12-09
    • 2020-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多