|
|
@ -1,4 +1,5 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<div class = "flow-container">
|
|
|
|
<div class = "post-detail-page">
|
|
|
|
<div class = "post-detail-page">
|
|
|
|
<!-- 左侧分类 包含分类 -->
|
|
|
|
<!-- 左侧分类 包含分类 -->
|
|
|
|
<SidebarCategory class="sidebar card" />
|
|
|
|
<SidebarCategory class="sidebar card" />
|
|
|
@ -9,6 +10,7 @@
|
|
|
|
<!-- 右侧作者信息 -->
|
|
|
|
<!-- 右侧作者信息 -->
|
|
|
|
<AuthorInfo class="author-info card" :author="post.author" />
|
|
|
|
<AuthorInfo class="author-info card" :author="post.author" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang = "ts">
|
|
|
|
<script setup lang = "ts">
|
|
|
@ -25,7 +27,37 @@ const postId = ref<number>(parseInt(route.params.id as string))
|
|
|
|
const post = ref({
|
|
|
|
const post = ref({
|
|
|
|
id: postId.value,
|
|
|
|
id: postId.value,
|
|
|
|
title: '帖子标题示例',
|
|
|
|
title: '帖子标题示例',
|
|
|
|
content: '这是帖子的详细内容,支持HTML或markdown',
|
|
|
|
content: `
|
|
|
|
|
|
|
|
# 欢迎来到论坛!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
这是一个使用 **Vue3** + **Vite** + **TypeScript** 搭建的论坛系统。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 功能清单
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 支持 Markdown 渲染
|
|
|
|
|
|
|
|
- 高亮代码块
|
|
|
|
|
|
|
|
- 响应式布局
|
|
|
|
|
|
|
|
- 用户评论系统
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 示例代码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\`\`\`ts
|
|
|
|
|
|
|
|
function greet(name: string): string {
|
|
|
|
|
|
|
|
return \`Hello, \${name}!\`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(greet('Vue'))
|
|
|
|
|
|
|
|
\`\`\`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 引用与链接
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
> “学习不是人生的全部,但如果连学习都掌握不了,你还能做什么?”
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
请访问 [Vue 官方文档](https://vuejs.org) 获取更多信息。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 图片测试
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
`,
|
|
|
|
author: {
|
|
|
|
author: {
|
|
|
|
id: 1,
|
|
|
|
id: 1,
|
|
|
|
name: '张三',
|
|
|
|
name: '张三',
|
|
|
@ -35,6 +67,7 @@ const post = ref({
|
|
|
|
tags: ['Vue3', '论坛开发', '学习笔记']
|
|
|
|
tags: ['Vue3', '论坛开发', '学习笔记']
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 可选:模拟异步获取
|
|
|
|
// 可选:模拟异步获取
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
// TODO: fetch(`/api/post/${postId.value}`) 替换为真实接口
|
|
|
|
// TODO: fetch(`/api/post/${postId.value}`) 替换为真实接口
|
|
|
@ -45,14 +78,11 @@ onMounted(() => {
|
|
|
|
<style scoped lang="scss">
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.post-detail-page {
|
|
|
|
.post-detail-page {
|
|
|
|
display:flex;
|
|
|
|
display:flex;
|
|
|
|
padding-top:550px;
|
|
|
|
|
|
|
|
width:92%;
|
|
|
|
|
|
|
|
gap:16px;
|
|
|
|
gap:16px;
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar{
|
|
|
|
.sidebar{
|
|
|
|
flex:1;
|
|
|
|
flex:2;
|
|
|
|
position:sticky;
|
|
|
|
position:sticky;
|
|
|
|
top:20px;
|
|
|
|
|
|
|
|
height: fit-content;
|
|
|
|
height: fit-content;
|
|
|
|
border-radius: 8px;
|
|
|
|
border-radius: 8px;
|
|
|
|
padding: 16px;
|
|
|
|
padding: 16px;
|
|
|
@ -66,7 +96,7 @@ onMounted(() => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.author-info{
|
|
|
|
.author-info{
|
|
|
|
flex:2;
|
|
|
|
flex:3;
|
|
|
|
position:sticky;
|
|
|
|
position:sticky;
|
|
|
|
flex-shrink:0;
|
|
|
|
flex-shrink:0;
|
|
|
|
height:fit-content;
|
|
|
|
height:fit-content;
|
|
|
|