_vm.paginated不是vue-paginate的函数错误

时间:2018-06-19 20:31:09

标签: vue.js vuejs2 vue-component nuxt.js

所以我尝试使用Vue-Paginate插件,但是,看到以下错误。

_vm.paginated is not a function

这是我的代码:

<template>
  <section :class="open ? 'block': 'hidden'">
    <!-- Start Results -->
    <h1 class="font-thin text-black text-center w-full">Cruise Results</h1>

    <section class="flex flex-wrap">
      <paginate name="cruises" :list="cruises" :per="3">
        <section class="shadow p-4 mb-4 w-full" v-for="cruise in paginated('cruises')" :key="cruise.id">
          <span class="text-md font-bold">{{ cruise.title }}</span>
          <span class="text-sm font-semibold">{{ cruise.summary }}</span>

          <section class="flex">
            <section class="text-lg">
              <span class="text-black">Inside</span>
              <br>
              <span class="text-red">£{{ cruise.inside }}</span>
            </section>
            <span class="pr-8"></span>
            <section class="text-lg">
              <span class="text-black">Balcony</span>
              <br>
              <span class="text-red">£{{ cruise.balcony }}</span>
            </section>
          </section>
        </section>
      </paginate>
    </section>
    <paginate-links for="cruises" :show-step-links="true"></paginate-links>
  </section>
  <!-- Cruise Results -->
</template>

<script>
import firebase from '@/middleware/firebase'
import VuePaginate from 'vue-paginate'

const database = firebase.database()

export default {
  components: {
    VuePaginate
  },
  data: function () {
    return {
      cruises: [],
      paginate: ['cruises']
    }
  },
  mounted () {
    database.ref('cruises').on('child_added', snapshot => this.cruises.push(snapshot.val()))
  }
}
</script>

我已经实现了firebase,并且相信我已经正确地遵循了文档。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您需要增加使用,如 setup

UPDATE P
    SET P.Inactivity = P.Inactivity + 50,
        P.Processed = 1
    FROM dbo.Players as P
    LEFT JOIN ( SELECT PlayerID
                FROM dbo.PlayerToWar
                WHERE WarID = @WarID
                ) X
    ON P.PlayerID = X.PlayerID
    WHERE P.PlayerID = NULL and P.Processed = 0

它将添加mixins,例如分页方法。

https://github.com/TahaSh/vue-paginate/blob/master/src/index.js#L16