<template>
  <z-paging ref="paging" v-model="list" :safe-area-inset-bottom="true" :hide-no-more-by-limit="10" @query="handleQuery">
    <university-item v-for="item in list" :key="item.id" :data="item" />
  </z-paging>
</template>
<script lang="ts" setup>
import type { Major } from '@/types';
import { getCollectedUniversities } from '@/api/modules/university';
import UniversityItem from '@/pagesOther/components/university-item.vue';

const list = ref<Major.University[]>([]);
const paging = ref<ZPagingInstance>();

const handleQuery = (page: number, size: number) => {
  getCollectedUniversities({ pageNum: page, pageSize: size }).then(res => {
    paging.value?.completeByTotal(res.rows, res.total);
  }).catch(() => paging.value?.complete(false));
}
</script>
<style lang="scss" scoped></style>