<template>
  <div class="sty">
      <div  class="content">
          <h1>{{title}}</h1>
          <div class="flex-center pos">
            <span style="margin-right:20px">发布时间:{{date}}</span>
            <span>作者:{{author}}</span>
          </div>
          <div  v-html = "contentList" style="width:600px;margin:0 auto"></div>
          <div class="flex-center" style="margin-buttom:40px">
            <el-button type="primary" style="margin-top:50px" @click="back" >返回</el-button>
          </div>
      </div>
  </div>
</template>

<script>
import {getnewsdetails} from '@/common/list.js'
export default {
    name: 'cardApplyQuery',
    data(){
        return{
            messageList:[],
            title:'',
            date:'',
            author:'',
            contentList:[]
        }
    },
    mounted(){
        let id = this.$route.query.id
        this.getnewsdetails(id)
        console.log(id+'+++++++++++++++++')
    },
    methods:{
        back(){
            /* this.$router.back() */
            window.history.back(-1)
        },
        async getnewsdetails(id){
            const {data} = await getnewsdetails(id)
            /* console.log(data+'---------------') */
            this.messageList = data
            this.title = data.title
            this.date = data.createTime
            this.author = data.author
            this.contentList = data.content
            console.log(data)
            console.log(this.messageList)
        }
    }
}
</script>

<style scoped>
.sty,.content{
    width:9.2rem;
    border:1px solid black;

}
h1{
    text-align: center;
    margin-top:20px;
    margin-bottom: 50px;

}
.pos{
    margin-bottom: 50px;
}
</style>