| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <template>
- <el-row class="movie-list">
- <el-col :md="18">
- <el-scrollbar style="width: 100%; height: 80vh;">
- <el-row class="movie-list">
- <el-card class="box-card" v-if="article !== null">
- <div slot="header" class="clearfix">
- <el-row>
- <span v-html="article.title" />
- </el-row>
- <el-divider />
- <el-row>
- <span v-html="article.publishAt" />
- </el-row>
- </div>
- <div class="text item">
- <el-row>
- <!-- <span v-html="article.content"></span>-->
- <markdown :source="article.content"></markdown>
- </el-row>
- <el-divider />
- <el-row>
- </el-row>
- </div>
- </el-card>
- </el-row>
- </el-scrollbar>
- </el-col>
- <el-col :md="6">
- <el-row class="movie-list">
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <el-row>
- <span>推荐文章</span>
- </el-row>
- </div>
- <div class="text item">
- <el-row />
- </div>
- </el-card>
- </el-row>
- </el-col>
- </el-row>
- </template>
- <script>
- import Markdown from 'vue-markdown'
- import { getPost } from '@/api/blog'
- export default {
- name: 'ArticlePage',
- components: { Markdown },
- data() {
- return {
- article: null,
- userAvatar: null,
- collected: false,
- collectedIcon: 'el-icon-star-off'
- }
- },
- created() {
- const articleId = this.$route.params.articleId
- this.getData(articleId)
- },
- methods: {
- getData(articleId) {
- getPost(articleId).then(resp => {
- if (resp.code === 0) {
- this.article = resp.data
- document.title = this.article.title
- }
- })
- },
- collectItem() {
- this.$message.info('暂未实现')
- if (this.collected) {
- console.log('取消收藏')
- this.collected = false
- this.collectedIcon = 'el-icon-star-off'
- } else {
- console.log('收藏')
- this.collected = true
- this.collectedIcon = 'el-icon-star-on'
- }
- }
- }
- }
- </script>
- <style scoped>
- /*处于手机屏幕时*/
- @media screen and (max-width: 768px) {
- .movie-list {
- padding: 5px;
- }
- }
- .movie-list {
- padding: 5px;
- }
- .clearfix:before,
- .clearfix:after {
- display: table;
- content: "";
- }
- .clearfix:after {
- clear: both;
- }
- </style>
|