<template>
  <div class="app-container">
    <el-table :data="comments" style="width: 100%">
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="name" label="姓名" width="100"></el-table-column>
      <el-table-column prop="phone" label="联系方式" width="120"></el-table-column>
      <el-table-column prop="comment" label="留言"></el-table-column>
      <el-table-column prop="indate" label="时间" width="160"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import request from "@/utils/request";
export default {
  data() {
    return {
      comments: []
    };
  },
  methods: {
    getComments() {
      request({
        url: "/comment/getComments",
        method: "post"
      })
        .then(response => {
          this.comments = response.data;
        })
        .catch(error => {
          console.log(error);
          this.$message({
            message: error,
            type: "error"
          });
        });
    }
  },
  mounted() {
    this.getComments();
  }
};
</script>

<style scoped>
</style>

