<template>
  <el-row class="row-bg" justify="center">
    <el-col :span="16">
  <el-timeline>
    <el-timeline-item center v-for="(times) in data" :timestamp="times.created_at" placement="top">
      <el-card>
        <h4>{{ times.title}}</h4>
        <p>{{times.content}}</p>
      </el-card>
    </el-timeline-item>
  </el-timeline>
    </el-col>
  </el-row>
</template>


<script>
import axios from "axios";
import * as dayjs from 'dayjs';
export default {
  data(){
    return{
      data:[],
    }
  },
  mounted() {
    axios.get('/api/v1/notice').then(res => {
      if (res.data.code === 200) {
        console.log(res.data.data);
        this.data = res.data.data;
        this.data.forEach(function(item,index){
          item.created_at = dayjs(item.created_at).format('YYYY-MM-DD HH:mm:ss');
        })
        this.data.reverse();
      }
    })
  }

}

</script>

<style>

</style>
