Skip to content

Commit a9cf0b1

Browse files
author
reco_luan
committed
feat: retain the page number when back
Fix the bug that the list page does not retain the page number
1 parent f17e9d5 commit a9cf0b1

File tree

18 files changed

+150
-9
lines changed

18 files changed

+150
-9
lines changed

components/HomeBlog.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export default {
108108
},
109109
mounted () {
110110
this.recoShow = true
111+
this._setPage(this._getStoragePage())
111112
},
112113
methods: {
113114
// 获取当前页码
@@ -128,13 +129,12 @@ export default {
128129
this.pages = pages.length == 0 ? [] : pages
129130
},
130131
getPagesByTags (tagInfo) {
131-
const currentTag = tagInfo.name
132-
const base = this.$site.base
133-
window.location.href = `${base}tag/?tag=${currentTag}`
132+
this.$router.push({ path: tagInfo.path })
134133
},
135134
_setPage (page) {
136135
this.currentPage = page
137136
this.$page.currentPage = page
137+
this._setStoragePage(page)
138138
}
139139
}
140140
}

example/docs/.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
title: "vuepress-theme-reco",
33
description: 'A simple and beautiful vuepress blog theme .',
4-
dest: 'public',
4+
dest: 'example/docs/public',
55
head: [
66
['link', { rel: 'icon', href: '/favicon.ico' }],
77
['meta', { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no' }]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: first page in category3
3+
date: 2018-12-15
4+
tags:
5+
- tag1
6+
categories:
7+
- category3
8+
---
9+
10+
first page in category3

0 commit comments

Comments
 (0)