List.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="new-list">
  3. <div class="new-item hand" v-for="item in newList" :key="item.id" @click="navTo('/open/laws/detail?id='+ item.id)">
  4. <div class="title clamp">
  5. <span class="title-icon"></span>
  6. {{ item.title }}
  7. </div>
  8. <div class="time">{{ item.release_time || item.add_time }}</div>
  9. </div>
  10. <el-pagination layout="prev, pager, next" :total="total" background prev-text="上一页" next-text="下一页" @current-change="currentChange" :page-size="limit" hide-on-single-page></el-pagination>
  11. </div>
  12. </template>
  13. <script>
  14. import { loadIndexs, splist, loveList, friendList , newsList, openList, regulationList } from '../../../request/api.js';
  15. export default {
  16. data() {
  17. return {
  18. newList: [],
  19. total: 0,
  20. page: 1,
  21. limit: 15
  22. };
  23. },
  24. // filters: {
  25. // time(val) {
  26. // let date = new Date(val * 1000);
  27. // let Y = date.getFullYear();
  28. // let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  29. // let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  30. // return Y + '-' + M + '-' + D;
  31. // }
  32. // },
  33. created() {
  34. this.getList()
  35. },
  36. methods:{
  37. navTo(url) {
  38. this.$router.push(url);
  39. },
  40. currentChange(e) {
  41. console.log(e);
  42. this.page = e
  43. this.getList()
  44. },
  45. getList() {
  46. let obj = this
  47. regulationList({
  48. page: obj.page,
  49. limit: obj.limit
  50. }).then(res => {
  51. obj.newList = res.data.list.map(item => {
  52. let arr = item.add_time.split(' ')
  53. item.add_time = arr[0]+''
  54. return item
  55. })
  56. obj.total = res.data.count
  57. })
  58. }
  59. }
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. .new-list {
  64. // padding: 0px 72px 0 40px;
  65. .new-item {
  66. display: flex;
  67. justify-content: space-between;
  68. font-size: 18px;
  69. font-family: PingFang SC;
  70. font-weight: 500;
  71. color: #666666;
  72. height: 40px;
  73. border-bottom: 1px solid #E5E5E5;
  74. line-height: 40px;
  75. &:hover {
  76. color: red;
  77. .title {
  78. .title-icon {
  79. border-left-color: red;
  80. }
  81. }
  82. }
  83. .title {
  84. width: 500px;
  85. .title-icon {
  86. display: inline-block;
  87. width: 0;
  88. height: 0;
  89. width: 0;
  90. height: 0;
  91. border-top: 6px solid transparent;
  92. border-left: 8px solid #d2d2d2;
  93. border-bottom: 6px solid transparent;
  94. }
  95. }
  96. }
  97. }
  98. /deep/ .el-pagination {
  99. margin-top: 50px;
  100. text-align: center;
  101. }
  102. </style>