add: 评论功能

This commit is contained in:
yi-ge 2020-07-06 18:13:28 +08:00
parent 3bba510ae0
commit f248fa1d11
3 changed files with 23 additions and 3 deletions

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"cSpell.words": [
"Weibo",
"Weixin",
"consola",
"fontawesome",
"fortawesome",
"nuxt"
]
}

View File

@ -5,5 +5,5 @@
nuxt
footer
.footer
| Copyright © 2018 WangYi. All Rights Reserved.
| Copyright © 2020 WangYi. All Rights Reserved.
</template>

View File

@ -25,7 +25,7 @@ div
.articelTitle 目录
.articelTocList(v-html="Articels.post_toc")
p(style="margin: 15px 0;")
img(src="https://cdn.wyr.me/imgs/reward.jpg" style="width: 100%")
img(src="https://cdn.wyr.me/imgs/reward.jpg" style="max-width: 100%; width: 200px")
p(style="margin: 15px 0;") 评论功能已被暂时关闭请通过 a@wyr.me 联系我
nuxt-link(:to="Articels.last ? '/post/' + Articels.last.ID : ''")
.btnFooter.btnPrevt(:style="'color: ' + (Articels.last ? '#333' : '#ccc')")
@ -36,6 +36,8 @@ div
| 下一篇 {{ Articels.next ? '(' + decodeTitle(Articels.next.post_name) + ')' : ''}} &nbsp;
Icon(:icon="['fas', 'chevron-right']")
.comment
div(v-for="(item, index) in Comments" :key="index")
| {{ item.comment_content }}
</template>
@ -54,8 +56,14 @@ export default {
result.postmetum.meta_value = 0
}
//
const tmp = await $axios.$get(`/public/comments/post?ID=${route.params.id}`)
const comments = tmp.result
console.log(comments)
return {
Articels: result,
Comments: comments,
showRightToc: false,
tocIds: result.post_toc_ids
}
@ -133,7 +141,9 @@ export default {
}
}
(adsbygoogle = window.adsbygoogle || []).push({}) // eslint-disable-line
try {
(adsbygoogle = window.adsbygoogle || []).push({}) // eslint-disable-line
} catch (_) { }
},
methods: {
decodeTitle (name) {