| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <el-row class="movie-list">
- <el-col :md="18">
- <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" />
- </el-row>
- <el-divider />
- <el-row>
- </el-row>
- </div>
- </el-card>
- </el-row>
- </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 { getArticle } from '@/api/article'
- // import { getUserInfo } from '@/api/user'
- import { getPost, getNewsDetail } from '@/api/blog'
- export default {
- name: 'ArticlePage',
- metaInfo: {
- meta: [
- { name: 'referrer', content: 'no-referrer' }
- ]
- },
- components: {},
- filters: {
- ellipsis(value) {
- if (!value) return ''
- const max = 20
- if (value.length > max) {
- return value.slice(0, max) + '...'
- }
- return value
- }
- },
- 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>
|