Skip to content

Commit 7acbbcb

Browse files
committed
feat: 详情页
1 parent cbd665a commit 7acbbcb

File tree

11 files changed

+487
-5
lines changed

11 files changed

+487
-5
lines changed

api/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ export default {
1515

1616
// column
1717
apiColumnDetail: `${apiBaseUrl}/column/detail`,
18+
19+
// detail
20+
apiArticleDetail: `${apiBaseUrl}/article/detail`,
1821
}

components/DetailSkeleton.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div class="skeleton-box">
3+
<div class="skeleton-bac-animation"></div>
4+
<skeleton-rect height="30px" margin="15px 0"></skeleton-rect>
5+
<div class="skeleton-row" style="margin: 15px 0">
6+
<skeleton-rect height="30px" width="50%"></skeleton-rect>
7+
<skeleton-rect height="30px" width="30%"></skeleton-rect>
8+
</div>
9+
<div class="skeleton-row" style="margin: 15px 0">
10+
<skeleton-rect height="25px" width="40%"></skeleton-rect>
11+
<skeleton-rect height="25px" width="40%"></skeleton-rect>
12+
</div>
13+
<div class="line"></div>
14+
<skeleton-rect height="20px" margin="10px 0"></skeleton-rect>
15+
<skeleton-rect height="20px" margin="10px 0"></skeleton-rect>
16+
<skeleton-rect height="20px" margin="10px 0"></skeleton-rect>
17+
<skeleton-rect height="20px" margin="10px 0" width="50%"></skeleton-rect>
18+
</div>
19+
</template>
20+
21+
<script>
22+
export default {
23+
name: 'DetailSkeleton',
24+
}
25+
</script>
26+
27+
<style lang="scss" scoped>
28+
@import '@/style/skeleton.scss';
29+
.line {
30+
margin: 20px 0 25px;
31+
height: 0;
32+
border-bottom: 1px solid #e6e6e6;
33+
}
34+
</style>

components/PageHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
:route="item.route"
3838
>{{ item.title }}</el-menu-item
3939
>
40-
<template v-if="!signStatus">
40+
<!-- <template v-if="!signStatus">
4141
<el-menu-item index="4" route="/signIn">登录</el-menu-item>
4242
</template>
4343
<template v-else>
@@ -71,7 +71,7 @@
7171
>
7272
<el-menu-item index="6-6" route="/signIn">退出</el-menu-item>
7373
</el-submenu>
74-
</template>
74+
</template> -->
7575
</el-menu>
7676
</div>
7777
</div>

components/PrevAndNext.vue

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div class="clearfix">
3+
<router-link
4+
:to="`/detail/${prevInfo.articleId}`"
5+
class="page-link fl ellipsis"
6+
>上一篇:<span>{{ prevInfo.articleTitle }}</span></router-link
7+
>
8+
<router-link
9+
:to="`/detail/${nextInfo.articleId}`"
10+
class="page-link fr ellipsis"
11+
>下一篇:<span>{{ nextInfo.articleTitle }}</span></router-link
12+
>
13+
</div>
14+
</template>
15+
16+
<script>
17+
export default {
18+
name: 'PrevAndNext',
19+
props: {
20+
prevInfo: {
21+
type: Object,
22+
default() {
23+
return {}
24+
},
25+
},
26+
nextInfo: {
27+
type: Object,
28+
default() {
29+
return {}
30+
},
31+
},
32+
},
33+
}
34+
</script>
35+
36+
<style lang="scss" scoped>
37+
@import './../style/common.scss';
38+
.page-link {
39+
color: $--color-info;
40+
max-width: 50%;
41+
text-decoration: none;
42+
&:hover {
43+
color: $--color-primary;
44+
}
45+
}
46+
</style>

nuxt.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ export default {
3737
css: ['element-ui/lib/theme-chalk/index.css', '@/style/common.scss'],
3838

3939
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
40-
plugins: ['@/plugins/element-ui', '@/plugins/axios', '@/plugins/moment'],
40+
plugins: [
41+
'@/plugins/element-ui',
42+
'@/plugins/axios',
43+
'@/plugins/moment',
44+
{
45+
src: '~/plugins/clipboard.js',
46+
mode: 'client',
47+
},
48+
],
4149

4250
// Auto import components: https://go.nuxtjs.dev/config-components
4351
components: true,

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
"dependencies": {
2626
"@nuxtjs/axios": "^5.13.1",
2727
"@nuxtjs/pwa": "^3.3.5",
28+
"clipboard": "^2.0.8",
2829
"core-js": "^3.9.1",
2930
"element-ui": "^2.15.1",
31+
"github-markdown-css": "^4.0.0",
32+
"highlight.js": "^11.2.0",
3033
"moment": "^2.29.1",
3134
"nuxt": "^2.15.3"
3235
},

0 commit comments

Comments
 (0)