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; + } }