1

我正在尝试在我的 vue3 typescript 应用程序上使用 laravel vue 分页

https://github.com/gilbitron/laravel-vue-pagination

我已经安装了库并在我的 index.ts 上注册了它

<template>
   <div>
    <table>
    <tr v-for="(hub, index) in hubs" :key="index">
      <td>{{ index + 1 }}</td>
      <td>{{ hub.name }}</td>
     <td>{{ hub.contact_address }}</td>
    </tr>
   </table>
    <pagination :data="hubs" @pagination-change-page="getResults"></pagination>
   </div>
</template>

Javascript

<script lang="ts">
export default {
  name: "AllHubs",
  setup() {
   let hubs = {}
 onMounted(() => {
      getResults();
    });

    const getResults = (page = 1) => {
      Admin.getAllHubs(1)
        .then((response) => {
          hubs = response.data;
        })
        .catch((error) => {

        })
        .finally(() => {

        });
    };
}

错误

[Vue warn]: Property "$createElement" was accessed during render but is not defined on instance. 
  at <AllHubs onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <RouterView> 
  at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <RouterView> 
  at <App>
4

0 回答 0