From 2a53d3e6774678eeebf2b0f028c6aec2c70a4774 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 10 十一月 2023 09:55:38 +0800 Subject: [PATCH] 2023.11.10 --- src/composables/fetchData.js | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/composables/fetchData.js b/src/composables/fetchData.js index 08c7b46..3598753 100644 --- a/src/composables/fetchData.js +++ b/src/composables/fetchData.js @@ -23,8 +23,22 @@ // 鏁版嵁鑾峰彇 function fetchData() { - fetch(currentPage, pageSize).then((res) => { - - }); + loadStatus.value = 1; + fetch(currentPage.value, pageSize.value) + .then((pageInfo) => { + currentPage.value = pageInfo.currentPage; + totalPage.value = pageInfo.totalPage; + total.value = pageInfo.total; + + loadStatus.value = 0; + }) + .catch(() => { + loadStatus.value = 3; + }) + .finally(() => { + loadStatus.value = 2; + }); } + + return {currentPage, totalPage, pageSize, total, loadStatus, fetchData} } -- Gitblit v1.9.3