index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="app-container">
  3. <el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
  4. <el-table-column align="center" label='ID' width="95">
  5. <template scope="scope">
  6. {{scope.$index}}
  7. </template>
  8. </el-table-column>
  9. <el-table-column label="Title">
  10. <template scope="scope">
  11. {{scope.row.title}}
  12. </template>
  13. </el-table-column>
  14. <el-table-column label="Author" width="110" align="center">
  15. <template scope="scope">
  16. <span>{{scope.row.author}}</span>
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="Pageviews" width="110" align="center">
  20. <template scope="scope">
  21. {{scope.row.pageviews}}
  22. </template>
  23. </el-table-column>
  24. <el-table-column align="center" prop="created_at" label="Display_time" width="200">
  25. <template scope="scope">
  26. <i class="el-icon-time"></i>
  27. <span>{{scope.row.display_time}}</span>
  28. </template>
  29. </el-table-column>
  30. </el-table>
  31. </div>
  32. </template>
  33. <script>
  34. import { getList } from '@/api/table'
  35. export default {
  36. data() {
  37. return {
  38. list: null,
  39. listLoading: true
  40. }
  41. },
  42. created() {
  43. this.fetchData()
  44. },
  45. methods: {
  46. fetchData() {
  47. this.listLoading = true
  48. getList(this.listQuery).then(response => {
  49. this.list = response.data.items
  50. this.listLoading = false
  51. })
  52. }
  53. }
  54. }
  55. </script>