12345678910111213141516171819202122232425262728293031323334353637 |
- import {
- reactive,
- toRefs
- } from "vue";
- import {
- catchError
- } from "@/utils/common.js"
- import * as httpCatalogue from "@/api/catalogue.js"
- import {useXuekeNianji} from "@/utils/cacheManager.js"
- export function useCatalogue() {
- const {getXueke} = useXuekeNianji();
-
- const { cardId = null, nianji = null } = getXueke()
-
- const data = reactive({
- xueke: null,
- nianji: null
- })
- data.nianji = nianji;
- data.xueke = cardId;
- async function getCatalogue() {
- return await catchError(httpCatalogue.getCatalogue({
- nianji: +data.nianji,
- cardId: +data.xueke
- }));
- }
- return {
- ...toRefs(data),
- // 获取章节数据
- getCatalogue
- }
- }
|