| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <div v-loading="loading">
- <div class="white-box">
- <div class="white-box-title">
- <h1>{{title}}</h1>
- <span>{{tool.formatDate(createdAt)}}</span>
- </div>
- <div v-html="content" class="white-box-content">
- </div>
- </div>
- </div>
- </template>
- <script>
- import Vue from 'vue'
- import network from '@/utils/network'
- import tool from '@/utils/tool'
- import store from '@/utils/vuexStore'
- import {SERVER_API_HTTP_TYPE,SERVER_API_DOMAIN} from '@/utils/config'
- export default {
- name: 'article_detail',
- mounted () {
- this.getData()
- },
- data () {
- return {
- title: null,
- content: null,
- createdAt: '',
- loading: true,
- tool: tool,
- }
- },
- methods: {
- handleCurrentChange (page) {
- this.getData(page, this.pageSize)
- },
- handleSizeChange (pageSize) {
- this.getData(this.currentPage, pageSize)
- },
- getData () {
- network.getData(`article/detail/${this.$route.params.id}`).then(response => {
- this.title = response.TITLE
- this.content = response.CONTENT
- this.createdAt = response.CREATED_AT
- this.loading = false
- })
- },
- getLink(fileUrl) {
- return fileUrl.indexOf('http') > -1 ? fileUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + fileUrl;
- },
- }
- }
- </script>
- <style scoped>
- .white-box-title span{color: #999}
- .white-box-content{font-size: 16px;padding: 15px 0;line-height: 2;}
- </style>
|