<template>
    <view class="page-content">
        <mx-nav-bar title="做题记录"/>
        <mx-tabs-swiper v-model="current" :tabs="subjects" :key-name="keyName" template="default" border>
            <template #="subject">
                <paper-record-list :subject-id="subject[keyValue]"/>
            </template>
        </mx-tabs-swiper>
    </view>
</template>

<script setup>
import {ref, watchEffect} from 'vue'
import {useTopicSubjects} from "@/pages/topic-center/hooks/useTopicSubjects";
import {useTransfer} from "@/hooks/useTransfer";
import _ from "lodash";
import PaperRecordList from "@/pages/topic-center/paper-record/components/paper-record-list.vue";

const {prevData} = useTransfer()
const {subjects, keyName, keyValue} = useTopicSubjects()
const current = ref(0)

watchEffect(() => current.value = _.findIndex(subjects.value, s => s[keyValue] == prevData.value.subjectId))
</script>

<style lang="scss">

</style>
