1.优化分类页面的点击分页后浏览量不显示的bug;2.优化点击分页后切换其他分类,分页没有初始化。

This commit is contained in:
reco_luan 2019-05-08 11:45:49 +08:00
parent 697e955a60
commit a371101a2b
4 changed files with 8 additions and 18 deletions

View File

@ -142,7 +142,6 @@ export default {
} }
this.isHasPageKey = pageKeys && pageKeys.indexOf(sessionStorage.getItem('pageKey')) > -1 this.isHasPageKey = pageKeys && pageKeys.indexOf(sessionStorage.getItem('pageKey')) > -1
console.log(123, this.isHasPageKey, pageKeys)
}, },
toggleSidebar (to) { toggleSidebar (to) {
this.isSidebarOpen = typeof to === 'boolean' ? to : !this.isSidebarOpen this.isSidebarOpen = typeof to === 'boolean' ? to : !this.isSidebarOpen

View File

@ -1,8 +1,9 @@
<template> <template>
<div class="abstract-wrapper"> <div class="abstract-wrapper">
<div <div
v-for="item in formatData" v-for="(item, index) in data"
:key="item.path" :key="item.path"
v-show="index >= (currentPage * 10 - 10) && index < currentPage * 10"
class="abstract-item"> class="abstract-item">
<div class="title"> <div class="title">
<router-link <router-link
@ -20,14 +21,7 @@ import PageInfo from './PageInfo'
export default { export default {
components: { PageInfo }, components: { PageInfo },
props: ['data', 'currentPage', 'currentTag'], props: ['data', 'currentPage', 'currentTag']
computed: {
formatData () {
const data = this.data
const currentPage = this.currentPage
return data.slice(currentPage * 10 - 10, currentPage * 10)
}
}
} }
</script> </script>

View File

@ -22,8 +22,8 @@
<script> <script>
import Common from '@theme/components/Common.vue' import Common from '@theme/components/Common.vue'
import NoteAbstract from '../components//NoteAbstract.vue' import NoteAbstract from '@theme/components/NoteAbstract.vue'
import Pagation from '../components//Pagation.vue' import Pagation from '@theme/components/Pagation.vue'
export default { export default {
components: { Common, NoteAbstract, Pagation }, components: { Common, NoteAbstract, Pagation },
@ -42,6 +42,7 @@ export default {
posts.sort((a, b) => { posts.sort((a, b) => {
return this._getTimeNum(b) - this._getTimeNum(a) return this._getTimeNum(b) - this._getTimeNum(a)
}) })
this.getCurrentPage(1)
return posts return posts
}, },
// //
@ -88,6 +89,4 @@ export default {
font-size .8em font-size .8em
float none float none
text-align left text-align left
</style> </style>

View File

@ -124,6 +124,4 @@ export default {
@media (max-width: $MQMobile) @media (max-width: $MQMobile)
.tags-wrapper .tags-wrapper
padding: 5rem 0.6rem 0; padding: 5rem 0.6rem 0;
</style> </style>