Skip to content

Commit

Permalink
🐞 fix: 点击推荐文章卡片后页面加载
Browse files Browse the repository at this point in the history
  • Loading branch information
wallleap committed Nov 23, 2023
1 parent 8d802fc commit ab21640
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/views/post/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
.post-body {
position: relative;
width: 100%;
min-height: 300px;
margin-top: -3em;
padding: 2em;
background-color: var(--bg-thin);
Expand Down Expand Up @@ -277,6 +276,10 @@
}
}

.post-main {
min-height: 300px;
}

.post-text {
.post-title {
font-size: 1.1rem;
Expand Down
12 changes: 10 additions & 2 deletions src/views/post/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
},
watch: {
$route() {
this.clearAllData()
this.getPostFn()
this.generateRelatesFn()
},
Expand Down Expand Up @@ -127,6 +128,13 @@ export default {
break
}
},
clearAllData() {
this.post = {}
this.relates = []
this.toc = ''
this.content = ''
this.loading = true
},
handleClick(e) {
const tocLinks = document.querySelectorAll('.toc-link')
if (e.target.classList.contains('toc-link')) {
Expand Down Expand Up @@ -159,7 +167,7 @@ export default {
</script>
<template>
<article v-loading="loading" class="post">
<article class="post">
<section ref="tocWrap" class="toc-wrap">
<div class="toc-header">
<div class="toc-title">
Expand Down Expand Up @@ -229,7 +237,7 @@ export default {
</div>
</div>
</div>
<div class="post-main">
<div v-loading="loading" class="post-main">
<Markdown :content="content" :parsed="true" />
</div>
</section>
Expand Down

0 comments on commit ab21640

Please sign in to comment.