index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div id="mediaLibraryApp">
  3. <TableComponent
  4. :columns="columns"
  5. :searchColumns="searchColumns"
  6. :getData="getData"
  7. />
  8. </div>
  9. </template>
  10. <script setup>
  11. import TableComponent from './TableComponent.vue';
  12. import { getmediaList } from "@/store/case";
  13. import { ref } from 'vue';
  14. // 模拟接口数据
  15. const mockData = [
  16. { id: 1, name: 'John', age: 20 },
  17. { id: 2, name: 'Jane', age: 25 },
  18. { id: 3, name: 'Bob', age: 30 },
  19. // 更多数据...
  20. ];
  21. // 定义表格列
  22. const columns = [
  23. // { prop: 'name', label: '名称', width: 150, },
  24. { prop: 'fileTypeStr', label: '文件类型', width: 100, },
  25. { prop: 'fileFormat', label: '文件格式', width: 80, },
  26. { prop: 'dictName', label: '分组', width: 100, },
  27. { prop: 'statusStr', label: '状态', width: 100, },
  28. { prop: 'createTime', label: '上传时间', width: 180, },
  29. ];
  30. // 定义搜索列
  31. const searchColumns = ref([
  32. ]);
  33. // 获取数据的函数
  34. const getData = async (params) => {
  35. // 这里可以调用后端接口获取数据
  36. const res = await getmediaList(params)
  37. return { list: res.list, totalCount: res.total }
  38. // .then(res => {
  39. // searchColumns.value = res.list
  40. // const totalCount = res.total;
  41. // return { list, totalCount };
  42. // });
  43. };
  44. </script>
  45. <style scoped>
  46. #mediaLibraryApp {
  47. font-family: Avenir, Helvetica, Arial, sans-serif;
  48. -webkit-font-smoothing: antialiased;
  49. -moz-osx-font-smoothing: grayscale;
  50. text-align: center;
  51. /* color: #2c3e50; */
  52. width: 100%;
  53. padding: 20px;
  54. /* background-color: rgba(58, 58, 58, 1); */
  55. }
  56. </style>