<template>
    <z-paging ref="paging" v-model="list" @query="handleQuery">
        <view class="p-20 grid grid-cols-2 gap-20">
            <ie-paper-item v-for="i in list" :key="i.id" :item="i"/>
        </view>
    </z-paging>
</template>

<script setup>
import {ref} from 'vue'
import {favPapers} from "@/api/webApi/webQue";
import {createPropDefine} from "@/utils";
import IePaperItem from "@/pagesOther/pages/topic-center/paper-entry/components/ie-paper-item.vue";

const props = defineProps({
    subjectId: createPropDefine(0, [String, Number])
})

const list = ref([])
const paging = ref(null)

const handleQuery = function (pageNum, pageSize) {
    const params = {pageNum, pageSize, type: 'paper', subjectId: props.subjectId}
    favPapers(params)
        .then(res => paging.value.completeByTotal(res.rows, res.total))
        .catch(e => paging.value.complete(false))
}
</script>

<style scoped>

</style>