<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'

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
      }).catch(response => {
      })
    },
  }
}

</script>

<style scoped>
  .white-box-title span{color: #999}
  .white-box-content{font-size: 16px;padding: 15px 0;line-height: 2;}
</style>
