Skip to content

Commit 5e69e8e

Browse files
committed
Replace $route with $router.currentRoute.value
1 parent 59b6e42 commit 5e69e8e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pages/docs/[docId]/meta.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default {
3939
return parseCodeblocks(this.doc.text)
4040
},
4141
createdAt() {
42-
if (this.$route.params.docId) {
42+
if (this.docId) {
4343
return moment(this.doc.createdAt).format('ddd, MMM Do, YYYY [at] h:mm A')
4444
}
4545
@@ -49,7 +49,10 @@ export default {
4949
return moment(this.doc.discardedAt).format('ddd, MMM Do, YYYY [at] h:mm A')
5050
},
5151
doc() {
52-
return this.$store.getters.decrypted.find((doc) => doc.id === this.$route.params.docId)
52+
return this.$store.getters.decrypted.find((doc) => doc.id === this.docId)
53+
},
54+
docId() {
55+
return this.$router.currentRoute.value.params?.docId
5356
},
5457
hasCodeblocks() {
5558
return this.codeblocks.length > 0
@@ -65,7 +68,7 @@ export default {
6568
})
6669
},
6770
savedAt() {
68-
if (this.$route.params.docId) {
71+
if (this.docId) {
6972
if (this.now.diff(this.doc.updatedAt, 'seconds') < 5) {
7073
return 'just now'
7174
} else {
@@ -76,7 +79,7 @@ export default {
7679
return 'Not yet saved'
7780
},
7881
updatedAt() {
79-
if (this.$route.params.docId) {
82+
if (this.docId) {
8083
return moment(this.doc.updatedAt).format('ddd, MMM Do, YYYY [at] h:mm A')
8184
}
8285

0 commit comments

Comments
 (0)