Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

90 rader
1.7 KiB

  1. {{#if template}}
  2. <template>
  3. <div class="{{ name }}-container">
  4. <base-table :table-config="tableProps" :table-data="list" :is-loading="listLoading">
  5. <method-btn slot="handleBtn" :method-list="tableBtn" @clickBtn="handleClick" />
  6. </base-table>
  7. <pagination v-show="total > listQuery.size" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  8. </div>
  9. </template>
  10. {{/if}}
  11. {{#if script}}
  12. <script>
  13. // edit here
  14. const tableBtn = [{
  15. type: 'edit',
  16. btnName: 'btn.edit'
  17. }, {
  18. type: 'delete',
  19. btnName: 'btn.delete'
  20. }]
  21. const tableProps = [{
  22. prop: '',
  23. label: '',
  24. width: '',
  25. filter: null,
  26. subcomponent: null,
  27. align: ''
  28. }]
  29. import BaseTable from '@/components/BaseTable'
  30. // edit here
  31. import { fetchList } from '@/api/article'
  32. import Pagination from '@/components/Pagination'
  33. import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
  34. export default {
  35. name: '{{ properCase name }}',
  36. props: {},
  37. components: { Pagination, BaseTable, MethodBtn },
  38. data() {
  39. return {
  40. tableBtn,
  41. tableProps,
  42. list: [],
  43. total: 0,
  44. listLoading: true,
  45. listQuery: {
  46. current: 1,
  47. size: 10
  48. }
  49. }
  50. },
  51. created() {
  52. this.getList()
  53. },
  54. mounted() {},
  55. methods: {
  56. handleClick(raw) {
  57. },
  58. getList() {
  59. this.listLoading = true
  60. // edit here
  61. fetchList(this.listQuery).then(response => {
  62. this.list = response.data.records
  63. this.total = response.data.total
  64. this.listLoading = false
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. {{/if}}
  71. {{#if style}}
  72. <style lang="scss" scoped>
  73. .{{ name }}-container {
  74. }
  75. .edit-input {
  76. padding-right: 100px;
  77. }
  78. .cancel-btn {
  79. position: absolute;
  80. right: 15px;
  81. top: 10px;
  82. }
  83. </style>
  84. {{/if}}