0

我是 Meil​​iSearch 的新手,正在尝试设置一个简单的演示。它与这个官方演示非常相似。我想知道如何更改应用程序中 20 个文档的默认限制?

4

1 回答 1

0

这可以通过<ais-configure :hitsPerPage="50" />. 例如:

<div class="search-panel__results">
  <ais-search-box placeholder="Search here…&quot; autofocus/>
  <ais-hits  :transform-items="transformItems">
    <template slot="item" slot-scope="{ item }">
      <ais-configure :hitsPerPage="50" />
      <div>
        <div class="hit-info"> {{ item.year }}</div>
        <div class="hit-info">
          <ais-highlight :hit="item" attribute="firstname" />
          &nbsp;
          <ais-highlight :hit="item" attribute="surname" />
        </div>
        <div class="hit-info motivation">
          <ais-highlight :hit="item" attribute="motivation" />
        </div>
      </div>
    </template>
  </ais-hits>
  <ais-pagination />
</div>

要更改默认分页限制为 200 次点击,请在 App.vue 文件(来自引用的官方演示)中将数据部分更新为以下内容(将 paginationTotalHits 设置为您想要的数字):

data() {
  return {
    searchClient: instantMeiliSearch(
      MEILISEARCH_HOST,
      MEILISEARCH_API_KEY,
      {
        paginationTotalHits: 300, // default: 200.
      }
    ),
  };
},
于 2021-06-06T02:29:06.073 回答