From 0c3358731247ee35dfa395437cf2e3e77d0585ac Mon Sep 17 00:00:00 2001 From: "LAPTOP-MI\\Lau-mi" Date: Tue, 28 May 2024 10:18:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=86=85=E5=AE=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 9 ++++++++- src/views/content/content.vue | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index c1feb89..8af07f2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,7 +6,14 @@ import { useRouterGuard } from './routerGuard/routerGuard' const router = createRouter({ history: createWebHashHistory('/'), - routes: [...loginRoute, ...authRoute] + routes: [...loginRoute, ...authRoute], + scrollBehavior(to, from, savedPosition) { + if (savedPosition) { + return savedPosition + } else { + return { top: 0, behavior: 'smooth' } + } + } }) useRouterGuard(router) diff --git a/src/views/content/content.vue b/src/views/content/content.vue index 22fa7c2..189d540 100644 --- a/src/views/content/content.vue +++ b/src/views/content/content.vue @@ -23,9 +23,15 @@ const searchFromData = ref({ timeRange: [], page: 1, size: 10, + total: 0, sort: 'desc' }) +const onCurrentPageChange = (n) => { + searchFromData.value.page = n + getContentListData() +} + const handleSubmitSearch = () => { getContentListData() } @@ -38,6 +44,7 @@ const getContentListData = () => { }).then((res) => { if (res.code === 20200) { blogList.value = res.data.list + searchFromData.value.total = res.data.total } else { ElMessage({ message: '获取内容列表失败', @@ -220,8 +227,9 @@ const onEditorSubmit = (data) => { @@ -234,10 +242,11 @@ const onEditorSubmit = (data) => { end-placeholder="结束日期" value-format="YYYY-MM-DD" clearable + disabled > - 搜索 + 搜索 @@ -246,6 +255,7 @@ const onEditorSubmit = (data) => { + { + +
+ +
{ } > .content-list { } + .list-pagination { + padding: 10px 40px; + display: flex; + justify-content: flex-end; + align-items: center; + } }